/* Design system repris tel quel de specialiste.net (charte-graphique-specialiste-net.md) */

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

:root {
  --white: #FFFFFF;
  --cream: #FAF7F2;
  --black: #0A0A0A;
  --navy: #1A1A2E;
  --blue: #2D6BE4;
  --grey-light: #F1ECE3;
  --grey-mid: #AAAAAA;
  --font-display: 'Cormorant Garamond', Georgia, serif;
  --font-body: 'Inter', system-ui, sans-serif;
}

html { scroll-behavior: smooth; }
body { font-family: var(--font-body); background: var(--cream); color: var(--black); font-size: 16px; line-height: 1.6; -webkit-font-smoothing: antialiased; }

/* NAV — deux niveaux : sections en haut, entrées de la section en dessous.
   Le sticky est porté par .app-header pour que les deux barres restent
   solidaires, sans avoir à caler la seconde sur la hauteur de la première. */
.app-header { position: sticky; top: 0; z-index: 100; }
nav.app-nav { display: flex; align-items: center; justify-content: space-between; padding: 18px 40px; background: rgba(250,247,242,0.95); backdrop-filter: blur(8px); border-bottom: 1px solid rgba(0,0,0,0.06); }
.logo { font-family: var(--font-display); font-size: 20px; font-weight: 600; color: var(--black); text-decoration: none; letter-spacing: -0.2px; }
.logo span { color: var(--blue); }
.nav-links { display: flex; gap: 24px; list-style: none; align-items: center; }
.nav-links a, .nav-links button { font-family: var(--font-body); font-size: 12px; font-weight: 400; letter-spacing: 0.08em; text-transform: uppercase; color: var(--black); text-decoration: none; opacity: 0.55; background: none; border: none; cursor: pointer; padding: 0; transition: opacity 0.2s; }
.nav-links a:hover, .nav-links button:hover { opacity: 1; }
.nav-links a.is-active { opacity: 1; font-weight: 500; }
/* Identifie qui est connecté, en <li> simple (pas de lien : le profil est
   atteint depuis la section Le Jeu). Même style que les entrées voisines,
   sans les états interactifs. */
.nav-user { font-family: var(--font-body); font-size: 12px; font-weight: 400; letter-spacing: 0.08em; text-transform: uppercase; color: var(--black); opacity: 0.55; }

nav.section-nav { display: flex; align-items: center; gap: 28px; padding: 0 40px; background: rgba(241,236,227,0.95); backdrop-filter: blur(8px); border-bottom: 1px solid rgba(0,0,0,0.06); }
.section-nav-item { font-size: 12px; font-weight: 400; letter-spacing: 0.04em; color: var(--black); text-decoration: none; opacity: 0.5; padding: 11px 0; border-bottom: 2px solid transparent; transition: opacity 0.2s, border-color 0.2s; }
.section-nav-item:hover { opacity: 1; }
.section-nav-item.is-active { opacity: 1; font-weight: 500; border-bottom-color: var(--blue); }
.section-nav-item.is-bientot { opacity: 0.38; }
.section-nav-item.is-bientot:hover { opacity: 0.7; }
.section-nav-bientot { font-size: 9px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--blue); border: 1px solid rgba(45,107,228,0.35); border-radius: 2px; padding: 1px 5px; margin-left: 4px; }

main.app-main { max-width: 700px; margin: 48px auto; padding: 0 24px 100px; }

h1, h2, h3 { font-family: var(--font-display); font-weight: 300; }

/* Contenu éditorial de long format (ex. /a-propos) — pas de spacing par
   défaut sur p/h2/ul/ol ailleurs dans l'appli, donc scopé à ce wrapper pour
   ne rien changer sur les autres pages. */
.prose h2 { font-size: 22px; margin: 40px 0 14px; }
.prose p { margin-bottom: 16px; line-height: 1.7; }
.prose ol, .prose ul { margin: 0 0 16px; padding-left: 24px; }
.prose li { margin-bottom: 8px; line-height: 1.7; }
.prose a { color: var(--blue); }

.page-title { font-family: var(--font-display); font-size: clamp(28px, 4vw, 40px); font-weight: 300; line-height: 1.15; color: var(--black); margin-bottom: 8px; }
.page-subtitle { font-size: 15px; font-weight: 300; color: var(--black); opacity: 0.6; margin-bottom: 32px; line-height: 1.7; }

.section-label { display: flex; align-items: center; gap: 14px; margin-bottom: 24px; }
.section-label::before { content: ''; display: block; width: 3px; height: 36px; background: var(--blue); flex-shrink: 0; }
.section-label-text { font-size: 11px; font-weight: 500; letter-spacing: 0.16em; text-transform: uppercase; color: var(--grey-mid); }

/* CARTES */
.card { background: var(--white); border: 1px solid rgba(0,0,0,0.08); border-radius: 2px; padding: 28px; margin-bottom: 14px; position: relative; overflow: hidden; transition: transform 0.2s; }
a.card { display: block; text-decoration: none; color: inherit; }
a.card:hover { transform: translateY(-2px); }
.card-accent { position: absolute; bottom: 0; left: 0; width: 0; height: 2px; background: var(--blue); transition: width 0.3s ease; }
a.card:hover .card-accent { width: 100%; }
.card-title { font-family: var(--font-display); font-size: 22px; font-weight: 400; color: var(--black); margin: 12px 0 6px; }
.card-desc { font-size: 14px; font-weight: 300; color: var(--black); opacity: 0.6; line-height: 1.7; }

/* TAGS */
.tag { display: inline-block; font-size: 10px; font-weight: 500; letter-spacing: 0.12em; text-transform: uppercase; color: var(--blue); border: 1px solid var(--blue); padding: 4px 10px; border-radius: 2px; margin-right: 6px; }
.tag-muted { color: var(--grey-mid); border-color: rgba(0,0,0,0.15); }

/* BOUTONS */
.btn-primary { display: inline-block; font-family: var(--font-body); font-size: 13px; font-weight: 500; letter-spacing: 0.08em; text-transform: uppercase; color: var(--white); background: var(--black); padding: 13px 28px; border: none; border-radius: 2px; text-decoration: none; cursor: pointer; transition: background 0.2s; }
.btn-primary:hover { background: var(--navy); }
.btn-ghost { display: inline-block; font-family: var(--font-body); font-size: 13px; font-weight: 400; letter-spacing: 0.08em; text-transform: uppercase; color: var(--black); opacity: 0.5; text-decoration: none; background: none; border: none; padding: 13px 0; border-bottom: 1px solid currentColor; cursor: pointer; transition: opacity 0.2s; }
.btn-ghost:hover { opacity: 1; }

/* FORMULAIRES */
.field { padding: 12px 16px; border: 1px solid rgba(0,0,0,0.15); border-radius: 2px; font-family: var(--font-body); font-size: 14px; background: var(--white); color: var(--black); width: 100%; }
.field:focus { outline: none; border-color: var(--blue); }
.field-row { display: flex; gap: 10px; align-items: flex-end; }
.field-row .field { flex: 1; }
.field-grow { resize: none; overflow-y: auto; line-height: 1.5; max-height: 200px; font-family: var(--font-body); }

/* CHAT — pages de conversation en direct (onboarding, rendez-vous) */
body.chat-page { display: flex; flex-direction: column; height: 100vh; overflow: hidden; }
body.chat-page main.app-main { flex: 1; display: flex; flex-direction: column; overflow: hidden; max-width: 1200px; width: 100%; margin: 0 auto; padding: 24px 24px 20px; }
.chat-header { flex-shrink: 0; }
.chat-header .page-title, .chat-header .page-subtitle { margin-bottom: 4px; }
.chat-header .section-label { margin-bottom: 12px; }

/* Layout à deux colonnes : chat + panneau des conclusions. Desktop only pour
   le MVP (petit groupe de testeurs) — pas de version mobile empilée. */
.chat-layout { flex: 1; display: flex; gap: 32px; overflow: hidden; }
.chat-column { flex: 1; min-width: 320px; display: flex; flex-direction: column; overflow: hidden; }
.conclusions-panel { flex-shrink: 0; width: clamp(240px, 27vw, 320px); overflow-y: auto; padding-top: 4px; }
.conclusions-panel .section-label { margin-bottom: 12px; }
.conclusions-panel .cta-box { margin-bottom: 16px; }
/* Accordéons compacts (conclusion / rdv / badge) : collapsed par défaut,
   plus léger que le .cta-box "pleine page" utilisé ailleurs. */
.conclusions-panel .cta-accordion { padding: 14px 18px; margin-bottom: 8px; }
.conclusions-panel .cta-accordion summary { cursor: pointer; font-size: 15px; margin-bottom: 0; }
.conclusions-panel .cta-accordion[open] summary { margin-bottom: 8px; }
.conclusions-panel .cta-accordion .cta-box-desc blockquote { margin: 8px 0; padding-left: 12px; border-left: 2px solid rgba(0,0,0,0.15); font-style: italic; }
.conclusions-panel .cta-accordion .cta-box-renvoi { font-size: 12px; opacity: 0.6; margin-top: 8px; }
.conclusions-empty { font-size: 13px; color: var(--grey-mid); opacity: 0.8; }

/* Layout à trois colonnes de /game (contacts + chat + conclusions). Réutilise
   .chat-column et .conclusions-panel à l'identique — seule la colonne des
   contacts est nouvelle. Desktop only comme le reste des écrans de jeu. */
.game-layout { flex: 1; display: flex; gap: 32px; overflow: hidden; }
body.chat-page main.app-main:has(.game-layout) { max-width: 1440px; }
.mobile-game-notice { display: none; }
.contacts-column { flex-shrink: 0; width: clamp(180px, 20vw, 240px); overflow-y: auto; padding-top: 4px; }
.contacts-column .section-label { margin-bottom: 12px; }
.contact-item { display: block; text-decoration: none; color: inherit; padding: 14px 16px; margin-bottom: 8px; border: 1px solid rgba(0,0,0,0.08); border-left: 2px solid transparent; border-radius: 2px; background: var(--white); transition: border-color 0.2s; }
.contact-item:hover { border-left-color: var(--grey-mid); }
.contact-item.is-active { border-left-color: var(--blue); background: var(--grey-light); }
.contact-item-nom { font-family: var(--font-display); font-size: 18px; margin: 8px 0 2px; }
.contact-item-fonction { font-size: 12px; font-weight: 300; opacity: 0.6; line-height: 1.5; }

/* Signe anonyme par badge obtenu avec ce PNJ — pas de compteur, pas de
   total affiché (voir docs/instructions-score-badges.md, principe "aucun
   compteur X/Y"). Rien du tout si zéro badge. */
.badge-dots { color: var(--blue); font-size: 8px; letter-spacing: 3px; margin-top: 8px; }

.thread-log { flex: 1; overflow-y: auto; border: 1px solid var(--grey-light); border-radius: 2px; padding: 24px; display: flex; flex-direction: column; gap: 16px; margin: 16px 0; background: var(--white); }
/* .msg-pnj est volontairement exclu du pre-wrap : son contenu est du vrai
   HTML de bloc rendu par marked (p, ul, li...), pas du texte brut — le
   pre-wrap ajouterait les retours à la ligne du HTML source de marked en
   plus des marges normales des balises, doublant l'espacement. */
.msg-joueur, .msg-narration { font-size: 15px; line-height: 1.6; white-space: pre-wrap; word-wrap: break-word; overflow-wrap: break-word; text-align: left; }
.msg-pnj { font-size: 15px; line-height: 1.6; word-wrap: break-word; overflow-wrap: break-word; text-align: left; }
.msg-narration { font-style: italic; opacity: 0.7; }
.msg-from { font-size: 11px; font-weight: 500; letter-spacing: 0.1em; text-transform: uppercase; color: var(--grey-mid); margin-bottom: 4px; white-space: normal; }

.msg-pnj p, .email-message-body p { margin: 0 0 0.8em; }
.msg-pnj p:last-child, .email-message-body p:last-child { margin-bottom: 0; }

.streaming::after { content: "▋"; display: inline-block; margin-left: 2px; animation: chat-cursor-blink 1s steps(1) infinite; opacity: 0.6; }
@keyframes chat-cursor-blink { 50% { opacity: 0; } }
.stream-error { color: #B3261E; font-size: 13px; margin-top: 8px; }

/* Diviseur narratif — marque le passage à une session de visio dans le thread */
.thread-divider { text-align: center; font-size: 12px; font-style: italic; color: var(--grey-mid); opacity: 0.8; margin: 8px 0; padding: 10px 0; border-top: 1px dashed rgba(0,0,0,0.12); border-bottom: 1px dashed rgba(0,0,0,0.12); }

/* EMAIL — fil à l'ancienne, texte simple, pas de bulles */
.email-message { border-bottom: 1px solid rgba(0,0,0,0.08); padding-bottom: 20px; }
.email-message-from { font-size: 11px; font-weight: 500; letter-spacing: 0.1em; text-transform: uppercase; color: var(--grey-mid); margin-bottom: 8px; }
.email-message-body { font-size: 15px; line-height: 1.75; min-height: 1.4em; }
/* Le message du joueur est du texte brut (pas de markdown) : garder ses
   retours à la ligne. Celui du PNJ est du HTML de bloc rendu (marked ou
   markdown_to_html côté serveur) — pas de pre-wrap dessus, cf. .msg-pnj plus haut. */
.email-message-body--joueur { white-space: pre-wrap; }
.email-header { border-bottom: 2px solid rgba(0,0,0,0.1); padding-bottom: 16px; margin-bottom: 24px; font-size: 13px; line-height: 1.8; }
.email-header div { margin-bottom: 6px; }

/* Encart CTA (cta-box) — reprend le composant du site, réservé aux messages
   brefs avec une action unique (ici : fin de rendez-vous, connexion...) */
.cta-box { background: var(--grey-light); padding: 32px 36px; border-radius: 2px; margin-bottom: 24px; }
.cta-box-title { font-family: var(--font-display); font-size: 20px; font-weight: 400; color: var(--black); margin-bottom: 8px; line-height: 1.3; }
.cta-box-desc { font-size: 14px; font-weight: 300; color: var(--black); opacity: 0.7; line-height: 1.7; margin-bottom: 6px; }

@media (max-width: 900px) {
  nav.app-nav, nav.section-nav, main.app-main { padding-left: 20px; padding-right: 20px; }
  .nav-links { gap: 14px; flex-wrap: wrap; justify-content: flex-end; row-gap: 8px; }
  /* La barre de section défile horizontalement plutôt que de passer à la
     ligne : la hauteur du bandeau reste stable d'une section à l'autre. */
  nav.section-nav { gap: 20px; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .section-nav-item { white-space: nowrap; }
  .field-row { flex-direction: column; align-items: stretch; }

  /* /game n'est pas encore jouable sur mobile (voir .mobile-game-notice) */
  .game-layout { display: none; }
  .mobile-game-notice { display: block; padding-top: 40px; text-align: center; }
}
