/* BTCFLOW — la meteo des marches Bitcoin.
   L'icone domine la page ; le reste la sert. Un seul fichier, zero dependance,
   coherent avec le reste de l'ecosysteme Skyex (vanilla, sombre, sobre). */

:root {
  --up: #34d399;
  --down: #f87171;
  --flat: #9ca3af;

  --bg: #0b0e14;
  --surface: #12161f;
  --surface-2: #1a2030;
  --border: #232a3b;
  --text: #e8ebf2;
  --text-dim: #8b93a7;

  /* Tons meteo — fond du hero + accent de l'icone. */
  --tone-a: #1a2030;
  --tone-b: #0b0e14;
  --tone-glow: rgba(255, 255, 255, 0.06);

  /* Signature Bitcoin : presente dans tous les etats, la meteo se pose dessus. */
  --btc-orange: #f7931a;
  --btc-orange-soft: rgba(247, 147, 26, 0.16);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100svh;
  background-color: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  line-height: 1.5;
}

/* Photo Pexels du jour. Un pseudo-element position:fixed dedie, PAS
   background-attachment:fixed — ce dernier force un repaint du fond a
   chaque frame de scroll sur mobile (Chrome/Safari Android), d'ou le lag
   et les artefacts observes. position:fixed est composite sur son propre
   calque GPU, independant du scroll : zero lag, quel que soit l'appareil. */
body.has-photo::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -1;
  background-image: linear-gradient(180deg, rgba(11, 14, 20, 0.5), rgba(11, 14, 20, 0.88)),
                     var(--bg-photo);
  background-size: cover, cover;
  background-position: center, center;
  background-repeat: no-repeat, no-repeat;
}

main {
  max-width: 720px;
  margin: 0 auto;
  padding: 0 1.25rem 3rem;
}

/* ---------- Hero / icone meteo ---------- */

.hero {
  padding: 4rem 1.25rem 3rem;
  text-align: center;
  /* Plus de panneau plein : juste deux lueurs douces (Bitcoin + tonalite
     meteo) posees directement sur la photo pleine page du body — rien ne
     doit cacher la photo, elle est la vedette. */
  background: radial-gradient(55% 45% at 88% 105%, var(--btc-orange-soft), transparent 70%),
              radial-gradient(120% 100% at 50% -10%, var(--tone-glow), transparent 60%);
  transition: background 900ms ease;
}

.hero[data-tone='building'] { --tone-glow: rgba(180, 190, 210, 0.10); }
.hero[data-tone='sun']      { --tone-glow: rgba(250, 204, 21, 0.22); }
.hero[data-tone='cloud']    { --tone-glow: rgba(148, 163, 184, 0.16); }
.hero[data-tone='rain']     { --tone-glow: rgba(96, 165, 250, 0.16); }
.hero[data-tone='storm']    { --tone-glow: rgba(248, 113, 113, 0.18); }

.icon-wrap {
  position: relative;
  display: inline-block;
}

.sky-icon {
  font-size: clamp(4.5rem, 22vw, 7rem);
  line-height: 1;
  filter: drop-shadow(0 8px 30px rgba(0, 0, 0, 0.35));
  animation: float 6s ease-in-out infinite;
}

.btc-badge {
  position: absolute;
  right: -0.4rem;
  bottom: 0.4rem;
  width: 2rem;
  height: 2rem;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--btc-orange);
  color: #fff;
  font-size: 1.1rem;
  font-weight: 700;
  box-shadow: 0 4px 14px rgba(247, 147, 26, 0.45), 0 0 0 3px var(--bg);
  animation: float 6s ease-in-out infinite;
}

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}

@media (prefers-reduced-motion: reduce) {
  .sky-icon { animation: none; }
}

.sky-label {
  margin: 1rem 0 0.35rem;
  font-size: 1.25rem;
  font-weight: 600;
}

.hero-tagline {
  margin: 0;
  color: var(--text-dim);
  font-size: 0.95rem;
}

.share-btn {
  margin-top: 1.5rem;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  font: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  padding: 0.5rem 1.1rem;
  border-radius: 999px;
  cursor: pointer;
  transition: background 150ms ease, border-color 150ms ease;
}

.share-btn:hover {
  background: rgba(255, 255, 255, 0.09);
  border-color: rgba(255, 255, 255, 0.18);
}

/* ---------- Prix ---------- */

.price {
  text-align: center;
  margin-bottom: 2rem;
}

.price-value {
  margin: 0;
  font-size: clamp(1.75rem, 6vw, 2.25rem);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
}

.price-meta, .price-error {
  margin: 0.25rem 0 0;
  color: var(--text-dim);
  font-size: 0.8rem;
}

/* ---------- Cohortes ---------- */

.cohorts-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}

.cohorts h2 {
  font-size: 1.05rem;
  margin: 0;
  color: var(--text-dim);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.horizon-toggle {
  display: inline-flex;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 3px;
  gap: 2px;
}

.horizon-btn {
  border: none;
  background: transparent;
  color: var(--text-dim);
  font: inherit;
  font-size: 0.85rem;
  padding: 0.35rem 0.7rem;
  border-radius: 7px;
  cursor: pointer;
}

.horizon-btn.active {
  background: var(--surface-2);
  color: var(--text);
}

.cohorts-table {
  width: 100%;
  border-collapse: collapse;
  background: color-mix(in srgb, var(--surface) 82%, transparent);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
}

.cohorts-table thead th {
  text-align: left;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-dim);
  padding: 0.6rem 0.8rem;
  border-bottom: 1px solid var(--border);
}

/* Les colonnes numeriques s'alignent a droite, en-tete comme donnees —
   sinon le titre part a gauche pendant que les chiffres dessous vont a droite. */
.cohorts-table thead th.num {
  text-align: right;
}

.cohorts-table tbody tr:not(:last-child) th,
.cohorts-table tbody tr:not(:last-child) td {
  border-bottom: 1px solid var(--border);
}

.cohorts-table th[scope='row'] {
  padding: 0.7rem 0.8rem;
  font-weight: 500;
  white-space: nowrap;
}

.cohorts-table td {
  padding: 0.7rem 0.8rem;
}

.cohort-icon { margin-right: 0.35rem; }

.cohort-hint {
  display: block;
  color: var(--text-dim);
  font-size: 0.72rem;
  font-weight: 400;
}

.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.delta-up { color: var(--up); }
.delta-down { color: var(--down); }
.delta-flat { color: var(--flat); }
.delta-empty { color: var(--text-dim); font-style: italic; font-size: 0.85rem; }

.export-btn {
  display: block;
  margin: 0.9rem auto 0;
  background: none;
  border: none;
  color: var(--text-dim);
  font: inherit;
  font-size: 0.8rem;
  text-decoration: underline;
  cursor: pointer;
}

.export-btn:hover {
  color: var(--text);
}

@media (max-width: 520px) {
  .cohorts-table thead { display: none; }
  .cohorts-table, .cohorts-table tbody, .cohorts-table tr, .cohorts-table th, .cohorts-table td {
    display: block;
    width: 100%;
  }
  .cohorts-table tr {
    padding: 0.75rem 0.9rem;
    border-bottom: 1px solid var(--border);
  }
  .cohorts-table tbody tr:last-child { border-bottom: none; }
  .cohorts-table th[scope='row'] { border: none !important; padding: 0 0 0.4rem; }
  .cohorts-table td {
    border: none !important;
    padding: 0.15rem 0;
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 0.75rem;
  }
  /* Le libelle vient de data-label (pose en JS via I18N), jamais fige en dur :
     sinon il reste en francais en anglais, et peut se tronquer au changement
     de langue sans qu'on s'en aperçoive. */
  .cohorts-table td::before {
    content: attr(data-label);
    color: var(--text-dim);
    flex: none;
  }
  /* Le nombre de BTC + le pourcentage doivent former UN seul enfant flex,
     sinon le pourcentage devient un 3e item et "justify-content: space-between"
     l'ecarte au milieu de la ligne au lieu de le garder colle au nombre. */
  .cell-value {
    text-align: right;
  }
}

/* ---------- Divers ---------- */

.status-note {
  text-align: center;
  color: var(--text-dim);
  font-size: 0.85rem;
  margin: 1.5rem 0;
}

.source-link {
  color: #5b9dfa;
  text-decoration: underline;
}

.source-link:hover {
  color: #7db4ff;
}

footer {
  margin-top: 2.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
  color: var(--text-dim);
  font-size: 0.78rem;
  text-align: center;
}

.photo-credit {
  margin: 1.25rem 0 0;
  font-size: 0.72rem;
  color: var(--text-dim);
}

.photo-credit a {
  color: inherit;
}

.ecosystem-links {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
  margin-top: 1.25rem;
  font-size: 0.78rem;
}

.ecosystem-links a {
  color: var(--text-dim);
  text-decoration: none;
}

.ecosystem-links a:hover {
  color: var(--text);
  text-decoration: underline;
}

.lang-toggle {
  margin-top: 1rem;
}

footer p { margin: 0; }
