/* ============================================================
   FRACTIO · landing page
   Chrome du Design System (Inter + glass-morphism + scrims)
   posée sur la VRAIE carte mondiale Leaflet/OSM Dark Matter.
   Couleurs des 4 factions = DB du jeu (Aether/Ember/Tide/Veil).
   ============================================================ */

@import url("https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=Inter+Tight:wght@500;600;700&family=JetBrains+Mono:wght@400;500;600&display=swap");

:root {
  /* neutrals (design tokens) */
  --bg-0:   #0A0B0D;
  --bg-1:   #13151A;
  --bg-2:   #1B1E25;
  --fg-0:   #F4F5F7;
  --fg-1:   #9CA3AF;
  --fg-2:   #5C6470;
  --line:   rgba(255,255,255,0.08);
  --line-strong: rgba(255,255,255,0.14);
  --highlight:   rgba(255,255,255,0.06);

  /* factions (couleurs DB jeu) */
  --faction-aether: #7F77DD;
  --faction-ember:  #D85A30;
  --faction-tide:   #1D9E75;
  --faction-veil:   #D4537E;

  --accent: var(--faction-aether);

  --font-sans:    "Inter", -apple-system, "SF Pro Text", system-ui, sans-serif;
  --font-display: "Inter Tight", "Inter", -apple-system, system-ui, sans-serif;
  --font-mono:    "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;

  --r-md: 14px;
  --r-lg: 20px;
  --r-pill: 999px;

  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
  --dur-fast: 160ms;
}

[data-faction="aether"] { --accent: var(--faction-aether); }
[data-faction="ember"]  { --accent: var(--faction-ember); }
[data-faction="tide"]   { --accent: var(--faction-tide); }
[data-faction="veil"]   { --accent: var(--faction-veil); }

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

html, body {
  background: var(--bg-0);
  color: var(--fg-0);
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 22px;
  min-height: 100vh;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a { color: inherit; text-decoration: none; }
ul { list-style: none; }
::selection { background: var(--fg-0); color: var(--bg-0); }

/* ---------- TYPO ---------- */

.t-cap {
  font-family: var(--font-sans);
  font-size: 11px;
  line-height: 14px;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--fg-1);
  white-space: nowrap;
}
.t-body {
  font-size: 15px;
  line-height: 22px;
  font-weight: 400;
  text-wrap: pretty;
}
.t-mono {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}

/* ---------- press / nav ---------- */

.press {
  transition: opacity var(--dur-fast) var(--ease), transform var(--dur-fast) var(--ease);
}
.press:active { opacity: 0.7; transform: scale(0.985); }

.nav-link {
  color: var(--fg-1);
  transition: color var(--dur-fast) var(--ease);
}
.nav-link:hover { color: var(--fg-0); }

/* ============================================================
   LAYOUT
   ============================================================ */

.landing { position: fixed; inset: 0; overflow: hidden; background: var(--bg-0); }

#lg-map {
  position: absolute;
  inset: 0;
  z-index: 1;
  background: var(--bg-0);
}

/* Leaflet container background + overrides */
.leaflet-container {
  background: var(--bg-0) !important;
  outline: none !important;
  font-family: var(--font-sans) !important;
}

.leaflet-control-attribution {
  position: absolute !important;
  right: 8px !important;
  bottom: 4px !important;
  background: transparent !important;
  color: var(--fg-2) !important;
  font-family: var(--font-mono) !important;
  font-size: 9px !important;
  letter-spacing: 0.02em !important;
  padding: 0 !important;
  z-index: 3 !important;
}
.leaflet-control-attribution a {
  color: var(--fg-1) !important;
  text-decoration: none !important;
}

/* Zoom controls (+ / -) — sobre, glass-morphism comme les chips */
.leaflet-control-zoom {
  margin-top: 96px !important;  /* clear le header (28px padding + ~50px contenu) */
  margin-right: 40px !important;
  border: 1px solid var(--line) !important;
  border-radius: var(--r-pill) !important;
  background: rgba(19,21,26,0.6) !important;
  backdrop-filter: blur(16px) saturate(140%);
  -webkit-backdrop-filter: blur(16px) saturate(140%);
  box-shadow: inset 0 1px 0 var(--highlight) !important;
  overflow: hidden;
}
.leaflet-control-zoom a {
  background: transparent !important;
  color: var(--fg-1) !important;
  border: none !important;
  font-family: var(--font-sans) !important;
  font-size: 18px !important;
  font-weight: 400 !important;
  line-height: 30px !important;
  width: 30px !important;
  height: 30px !important;
  transition: color var(--dur-fast) var(--ease), background var(--dur-fast) var(--ease);
}
.leaflet-control-zoom a:hover {
  background: rgba(255,255,255,0.06) !important;
  color: var(--fg-0) !important;
}
.leaflet-control-zoom-in {
  border-bottom: 1px solid var(--line) !important;
}

.leaflet-tooltip {
  background: rgba(19,21,26,0.78) !important;
  color: var(--fg-0) !important;
  border: 1px solid var(--line) !important;
  border-radius: var(--r-md) !important;
  padding: 8px 12px !important;
  font-family: var(--font-sans) !important;
  font-size: 11px !important;
  letter-spacing: 0.04em !important;
  text-transform: uppercase !important;
  font-weight: 500 !important;
  backdrop-filter: blur(16px) saturate(140%);
  -webkit-backdrop-filter: blur(16px) saturate(140%);
  box-shadow: inset 0 1px 0 var(--highlight);
}
.leaflet-tooltip::before { display: none !important; }
.leaflet-tooltip .tt-faction {
  font-weight: 600;
  letter-spacing: 0.10em;
  margin-right: 10px;
}
.leaflet-tooltip .tt-area {
  font-family: var(--font-mono);
  letter-spacing: -0.01em;
  text-transform: none;
  color: var(--fg-0);
}

/* Beacon pulse (visible signal au zoom monde) */
.beacon {
  filter: drop-shadow(0 0 6px rgba(255, 255, 255, 0.35));
  animation: beacon-pulse 2.4s ease-in-out infinite;
}
@keyframes beacon-pulse {
  0%, 100% { opacity: 0.95; }
  50%      { opacity: 0.55; }
}

/* ---------- scrims ---------- */

.lg-scrim-top {
  position: absolute; top: 0; left: 0; right: 0; height: 160px;
  pointer-events: none; z-index: 2;
  background: linear-gradient(to bottom, rgba(10,11,13,0.78), rgba(10,11,13,0));
}
.lg-scrim-bottom {
  position: absolute; bottom: 0; left: 0; right: 0; height: 360px;
  pointer-events: none; z-index: 2;
  background: linear-gradient(to bottom,
    rgba(10,11,13,0),
    rgba(10,11,13,0.55) 50%,
    rgba(10,11,13,0.92));
}

/* ---------- header ---------- */

.lg-header {
  position: absolute; top: 0; left: 0; right: 0;
  padding: 28px 40px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 24px;
  z-index: 4;
  pointer-events: none;       /* let map clicks pass through empty header gap */
}
.lg-header > * { pointer-events: auto; }
.lg-brand { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.lg-brand-wordmark { height: 22px; width: auto; display: block; }
.lg-brand-meta { color: var(--fg-2); }
.lg-brand-meta .t-mono {
  font-size: 11px;
  color: var(--fg-1);
  letter-spacing: -0.01em;
}

.lg-nav { display: flex; gap: 28px; align-items: center; }
.lg-nav-cta {
  padding: 10px 18px;
  border-radius: var(--r-md);
  background: var(--fg-0);
  color: var(--bg-0);
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
}
.lg-nav-cta:hover { opacity: 0.92; }

/* ============================================================
   BOTTOM HUD STACK
   ============================================================
   On desktop, .lg-bottom-stack is a passthrough wrapper — each child
   keeps its absolute positioning via the rules below.
   On mobile (≤720px) the stack becomes a flex column at the bottom,
   children switch to position: static.
   ============================================================ */

.lg-bottom-stack {
  position: absolute;
  inset: 0;
  z-index: 4;
  pointer-events: none;       /* the wrapper itself doesn't catch clicks */
}
.lg-bottom-stack > * { pointer-events: auto; }

/* ---------- info panel (bottom-right desktop) ---------- */

.lg-info {
  position: absolute; right: 40px; bottom: 40px;
  width: 360px; padding: 28px 26px 24px;
  background: rgba(19,21,26,0.78);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  backdrop-filter: blur(24px) saturate(140%);
  -webkit-backdrop-filter: blur(24px) saturate(140%);
  box-shadow: inset 0 1px 0 var(--highlight);
  z-index: 5;
  transform-origin: bottom right;
  transition: opacity 240ms var(--ease), transform 240ms var(--ease);
}
.lg-info.is-dismissed,
.lg-mobile-tagline.is-dismissed {
  opacity: 0;
  transform: scale(0.96);
  pointer-events: none;
}
/* Une fois la transition finie on cache vraiment l'élément (display:none)
   via une classe ajoutée par le JS pour que la carte cesse de capturer
   les clics et libère l'espace en mobile (le stack se recompose). */
.lg-info.is-hidden,
.lg-mobile-tagline.is-hidden {
  display: none !important;
}

/* ---------- dismiss button (× corner / inline) ---------- */

.lg-dismiss {
  appearance: none;
  background: transparent;
  border: 1px solid var(--line);
  color: var(--fg-1);
  border-radius: var(--r-pill);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex: 0 0 auto;
  transition: color var(--dur-fast) var(--ease),
              border-color var(--dur-fast) var(--ease),
              background var(--dur-fast) var(--ease);
}
.lg-dismiss:hover {
  color: var(--fg-0);
  border-color: var(--line-strong);
  background: rgba(255,255,255,0.04);
}
.lg-dismiss:focus-visible {
  outline: 1px solid var(--line-strong);
  outline-offset: 2px;
}

/* corner variant : posé en haut à droite du panel info */
.lg-dismiss-corner {
  position: absolute;
  top: 14px; right: 14px;
  width: 28px; height: 28px;
}

/* inline variant : intégré dans la barre tagline mobile, après le lien */
.lg-dismiss-inline {
  width: 24px; height: 24px;
  margin-left: 4px;
}
.lg-info-mark { display: flex; align-items: center; gap: 14px; margin-bottom: 22px; }
.lg-info-mark img { width: 48px; height: 48px; border-radius: 10px; display: block; }
.lg-info-mark-labels { display: flex; flex-direction: column; gap: 2px; }

.lg-info-copy { margin-bottom: 22px; color: var(--fg-0); }
.lg-info-divider { height: 1px; background: var(--line); margin-bottom: 18px; }

.lg-cta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-radius: var(--r-md);
  font-size: 14px;
  font-weight: 500;
  margin-bottom: 10px;
}
.lg-cta-primary { background: var(--fg-0); color: var(--bg-0); }
.lg-cta-arrow { font-family: var(--font-mono); font-size: 14px; }
.lg-cta-ghost {
  background: transparent;
  color: var(--fg-0);
  border: 1px solid var(--line-strong);
  justify-content: center;
  margin-bottom: 0;
}

/* ---------- faction legend (bottom-left desktop) ---------- */

.lg-legend {
  position: absolute; left: 40px; bottom: 40px;
  display: flex; flex-direction: column; gap: 14px;
  z-index: 4;
  max-width: calc(100% - 80px);
}
.lg-legend-chips {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  max-width: 480px;
}
.lg-chip {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px 8px 10px;
  background: rgba(19,21,26,0.6);
  backdrop-filter: blur(16px) saturate(140%);
  -webkit-backdrop-filter: blur(16px) saturate(140%);
  border: 1px solid var(--line);
  border-radius: var(--r-pill);
  flex: 0 0 auto;
  transition: border-color var(--dur-fast) var(--ease);
}
.lg-chip-dot {
  display: inline-block;
  width: 8px; height: 8px;
  border-radius: 999px;
  background: var(--accent);
  box-shadow: 0 0 6px var(--accent);
}
.lg-chip-name { color: var(--accent); }
.lg-chip-pct {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--fg-1);
  letter-spacing: -0.01em;
}

/* ============================================================
   LIVE CAPTURE FEED (desktop: bottom-left, above the legend)
   ============================================================ */

.lg-feed-wrap {
  position: absolute;
  left: 40px;
  bottom: 156px;              /* clear de la légende en bas */
  width: 380px;
  max-width: calc(100% - 80px);
  z-index: 4;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.lg-feed-head {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--fg-1);
}
.lg-feed-livedot {
  width: 7px; height: 7px; border-radius: 999px;
  background: #F4F5F7;
  box-shadow: 0 0 0 0 rgba(244,245,247,0.9);
  animation: lg-livepulse 1.6s ease-out infinite;
  flex: 0 0 auto;
}
@keyframes lg-livepulse {
  0%   { box-shadow: 0 0 0 0 rgba(244,245,247,0.6); }
  70%  { box-shadow: 0 0 0 7px rgba(244,245,247,0); }
  100% { box-shadow: 0 0 0 0 rgba(244,245,247,0); }
}
.lg-feed-rule {
  flex: 1 1 auto;
  height: 1px;
  background: linear-gradient(to right, var(--line), transparent);
}

.lg-feed {
  position: relative;
  width: 100%;
  height: 96px;               /* 3 rows × 32px par défaut (desktop) */
  overflow: hidden;
  will-change: contents;
  mask-image: linear-gradient(to bottom, black 0%, black calc(100% - 14px), transparent 100%);
  -webkit-mask-image: linear-gradient(to bottom, black 0%, black calc(100% - 14px), transparent 100%);
}
.lg-feed-empty {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  padding: 0 12px;
  color: var(--fg-2);
}
.lg-feed-row {
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 32px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 12px 0 14px;
  white-space: nowrap;
  background: rgba(13,15,19,0.55);
  backdrop-filter: blur(10px) saturate(140%);
  -webkit-backdrop-filter: blur(10px) saturate(140%);
  border: 1px solid var(--line);
  border-radius: 10px;
  will-change: transform, opacity;
}
.lg-feed-bar {
  position: absolute; left: 6px; top: 8px; bottom: 8px; width: 2px;
  background: var(--accent);
  border-radius: 2px;
  box-shadow: 0 0 6px var(--accent);
}
.lg-feed-faction { color: var(--accent); font-size: 11px; }
.lg-feed-verb    { color: var(--fg-2); }
.lg-feed-area    {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: 12px;
  color: var(--fg-0);
  letter-spacing: -0.01em;
}
.lg-feed-unit    { color: var(--fg-2); }
.lg-feed-time    {
  margin-left: auto;
  color: var(--fg-2);
  font-variant-numeric: tabular-nums;
  flex: 0 0 auto;
}

/* ---------- mobile tagline (hidden on desktop) ---------- */

.lg-mobile-tagline { display: none; }

/* Reduce motion */
@media (prefers-reduced-motion: reduce) {
  .beacon, .lg-feed-livedot { animation: none !important; }
  .lg-feed-row { transition: none !important; }
}

/* ============================================================
   RESPONSIVE
   ============================================================ */

@media (max-width: 1100px) {
  .lg-header { padding: 22px 24px; }
  .lg-legend   { left: 24px; bottom: 32px; }
  .lg-info     { right: 24px; bottom: 32px; width: 320px; }
  .lg-feed-wrap { left: 24px; bottom: 148px; }
}

@media (max-width: 720px) {
  /* Header compact */
  .lg-header {
    padding: 16px 16px 0;
    align-items: center;
    gap: 12px;
  }
  .lg-brand { gap: 6px; }
  .lg-brand-wordmark { height: 18px; }
  .lg-brand-meta { font-size: 10px; letter-spacing: 0.10em; }
  .lg-nav { gap: 0; }
  .lg-nav-link { display: none; }
  .lg-nav-cta { padding: 9px 14px; font-size: 12px; border-radius: 12px; }

  /* Le stack passe en flex column en pile en bas, pleine largeur */
  .lg-bottom-stack {
    position: absolute;
    inset: auto 0 max(20px, env(safe-area-inset-bottom)) 0;
    top: auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 0 16px;
    z-index: 5;
    max-height: calc(100dvh - 80px);
    pointer-events: none;
  }
  .lg-bottom-stack > * { pointer-events: auto; }

  /* Tous les enfants : position statique, pleine largeur */
  .lg-bottom-stack .lg-legend,
  .lg-bottom-stack .lg-feed-wrap,
  .lg-bottom-stack .lg-info,
  .lg-bottom-stack .lg-mobile-tagline {
    position: static;
    left: auto; right: auto; top: auto; bottom: auto;
    width: auto;
    max-width: none;
  }

  /* Tagline mobile visible */
  .lg-mobile-tagline {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 14px;
    background: rgba(19,21,26,0.72);
    backdrop-filter: blur(16px) saturate(140%);
    -webkit-backdrop-filter: blur(16px) saturate(140%);
    border: 1px solid var(--line);
    border-radius: 14px;
    font-size: 13px;
    line-height: 18px;
    color: var(--fg-1);
  }
  .lg-mobile-tagline strong {
    color: var(--fg-0);
    font-weight: 500;
  }
  .lg-mobile-tagline a {
    color: var(--fg-0);
    font-size: 11px;
    letter-spacing: 0.10em;
    text-transform: uppercase;
    white-space: nowrap;
    padding-left: 12px;
    border-left: 1px solid var(--line);
  }

  /* Legend : scroll horizontal avec fade à droite */
  .lg-legend { gap: 10px; }
  .lg-legend-chips {
    flex-wrap: nowrap;
    overflow-x: auto;
    gap: 8px;
    max-width: none;
    scrollbar-width: none;
    -ms-overflow-style: none;
    padding-bottom: 2px;
    mask-image: linear-gradient(to right, black calc(100% - 24px), transparent);
    -webkit-mask-image: linear-gradient(to right, black calc(100% - 24px), transparent);
  }
  .lg-legend-chips::-webkit-scrollbar { display: none; }
  .lg-chip { padding: 7px 12px 7px 10px; }

  /* Feed : 2 lignes visibles sur mobile */
  .lg-feed-wrap { gap: 8px; }
  .lg-feed { height: 64px; }
  .lg-feed-row { font-size: 11px; padding: 0 10px 0 12px; }
  .lg-feed-time { font-size: 10px; }

  /* La grosse carte d'info est masquée — le CTA Télécharger vit dans le header */
  .lg-info { display: none; }

  /* Scrims un peu réduits sur mobile */
  .lg-scrim-top    { height: 110px; }
  .lg-scrim-bottom { height: 320px; }

  /* Zoom controls : ramener plus haut pour ne pas chevaucher le stack */
  .leaflet-control-zoom {
    margin-top: 80px !important;
    margin-right: 16px !important;
  }
}

@media (max-width: 380px) {
  /* Sur très petit écran, on cache la ligne de stats sous le wordmark */
  .lg-brand-meta { display: none; }
}
