/* ==========================================================================
   J-730 — direction visuelle : "l'horloge de mission qui contient un journal"
   Minimaliste, moderne. Space Grotesk (UI) + Space Mono (horloge & dates).
   Accent : braise / ember — la mèche qui brûle vers la sortie.
   ========================================================================== */

/* ---- Tokens --------------------------------------------------------------- */
:root {
  --bg:      #F7F6F3;
  --surface: #FFFFFF;
  --ink:     #17181C;
  --muted:   #6C7079;
  --faint:   #9A9DA4;
  --line:    #E7E5E0;
  --accent:  #4F46E5;
  --accent-soft: rgba(79, 70, 229, 0.12);
  --danger:  #B23A34;
  --on-accent: #FFFFFF;

  --sans: "Space Grotesk", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "Space Mono", ui-monospace, "SFMono-Regular", "JetBrains Mono", monospace;

  --step: clamp(0.9rem, 0.85rem + 0.2vw, 1rem);
  --radius: 10px;
  --wrap: 40rem;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg:      #0D0E11;
    --surface: #15171B;
    --ink:     #ECEDEF;
    --muted:   #9096A0;
    --faint:   #626873;
    --line:    #23262C;
    --accent:  #818CF8;
    --accent-soft: rgba(129, 140, 248, 0.18);
    --danger:  #E06A63;
    --on-accent: #10112E;
  }
}
/* Le toggle explicite du visiteur gagne dans les deux sens. */
:root[data-theme="dark"] {
  --bg:      #0D0E11;
  --surface: #15171B;
  --ink:     #ECEDEF;
  --muted:   #9096A0;
  --faint:   #626873;
  --line:    #23262C;
  --accent:  #818CF8;
  --accent-soft: rgba(129, 140, 248, 0.18);
  --danger:  #E06A63;
  --on-accent: #10112E;
}

/* ---- Reset léger ---------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: var(--step);
  line-height: 1.5;
  font-feature-settings: "ss01";
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
img { max-width: 100%; height: auto; display: block; }
a { color: inherit; }
button { font-family: inherit; }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 4px;
}

/* ---- Boutons -------------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .5ch;
  font-family: var(--sans);
  font-size: .95rem;
  font-weight: 500;
  line-height: 1;
  padding: .72em 1.25em;
  border: 1px solid transparent;
  border-radius: var(--radius);
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  text-decoration: none;
  transition: background .18s ease, border-color .18s ease, transform .05s ease, color .18s ease;
}
.btn:active { transform: translateY(1px); }
.btn--primary {
  background: var(--accent);
  color: var(--on-accent);
  font-weight: 600;
}
.btn--primary:hover { filter: brightness(1.06); }
/* Une couleur par fondateur sur la page de connexion */
.btn__emoji { margin-right: .55ch; font-size: 1.15em; line-height: 1; }
.btn--pierre { background: #4F46E5; color: #fff; }  /* 🦔 indigo */
.btn--louis  { background: #E11D48; color: #fff; }  /* 🚀 rose */
.btn--pierre:hover, .btn--louis:hover { filter: brightness(1.06); }
.btn--ghost {
  border-color: var(--line);
  color: var(--muted);
}
.btn--ghost:hover { border-color: var(--ink); color: var(--ink); }
.btn--danger {
  background: transparent;
  border-color: color-mix(in srgb, var(--danger) 45%, transparent);
  color: var(--danger);
}
.btn--danger:hover { background: color-mix(in srgb, var(--danger) 12%, transparent); }

/* ==========================================================================
   COMPTE À REBOURS — le signal, deux échelles
   ========================================================================== */

/* Hero (déconnecté) : la pièce maîtresse */
.countdown-big {
  font-family: var(--mono);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  font-size: clamp(2.6rem, 11vw, 7.5rem);
  line-height: .95;
  letter-spacing: -0.04em;
  color: var(--ink);
  white-space: nowrap;
  position: relative;
  z-index: 1;
}

/* Discret (connecté) : lecture d'instrument dans la navbar */
.navbar__countdown {
  display: inline-flex;
  align-items: center;
  gap: .55ch;
  font-family: var(--mono);
  font-size: .82rem;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
  color: var(--muted);
}
.navbar__dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 0 var(--accent-soft);
  animation: pulse 3.2s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 var(--accent-soft); opacity: .85; }
  50%      { box-shadow: 0 0 0 5px transparent; opacity: 1; }
}

/* ==========================================================================
   ÉCRANS D'AUTHENTIFICATION
   ========================================================================== */
.screen-auth main {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 2rem 1.25rem;
  position: relative;
  overflow: hidden;
}
/* la braise : halo ambiant derrière l'horloge (statique, sûr en reduced-motion) */
.screen-auth main::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(60% 45% at 50% 42%,
              var(--accent-soft) 0%, transparent 70%);
  pointer-events: none;
}
.auth {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2.5rem;
  width: 100%;
  max-width: 30rem;
  text-align: center;
}
.auth__brand {
  margin: 0;
  font-family: var(--mono);
  font-size: .78rem;
  font-weight: 700;
  letter-spacing: .4em;
  text-indent: .4em;
  text-transform: uppercase;
  color: var(--accent);
}
.auth-form {
  display: flex;
  flex-direction: column;
  gap: .9rem;
  width: 100%;
  max-width: 20rem;
}
.auth-form input[type="email"],
.auth-form input[type="text"],
.auth-form input:not([type]) {
  width: 100%;
  font-family: var(--mono);
  font-size: 1rem;
  text-align: center;
  letter-spacing: .04em;
  padding: .85em 1em;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  transition: border-color .18s ease;
}
.auth-form input:focus { outline: none; border-color: var(--accent); }
.auth-form .btn { width: 100%; }
.error {
  margin: 0;
  font-size: .85rem;
  color: var(--danger);
}

/* ==========================================================================
   NAVBAR (connecté)
   ========================================================================== */
.navbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 1.25rem;
  padding: .9rem clamp(1rem, 4vw, 2rem);
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--line);
}
.navbar__brand {
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: -0.02em;
  text-decoration: none;
  color: var(--ink);
}
.navbar__countdown { margin-right: auto; }
.navbar__actions {
  display: inline-flex;
  gap: 1.25rem;
  font-size: .9rem;
}
.navbar__actions a {
  color: var(--muted);
  text-decoration: none;
  transition: color .18s ease;
}
.navbar__actions a:hover { color: var(--ink); }

/* ==========================================================================
   PROGRESS BAR — progression vers l'échéance (calculée au chargement, pas de JS)
   ========================================================================== */
.progress { display: inline-flex; align-items: center; gap: .7ch; }
.progress__track {
  flex: 1;
  background: var(--accent-soft);
  border-radius: 999px;
  overflow: hidden;
}
.progress__fill {
  display: block;
  height: 100%;
  background: var(--accent);
  border-radius: 999px;
}
/* Auth (déconnecté) : large, avec le % */
.progress--auth { width: min(20rem, 72vw); }
.progress--auth .progress__track { height: 6px; }
.progress--auth .progress__label {
  font-family: var(--mono);
  font-size: .78rem;
  font-variant-numeric: tabular-nums;
  color: var(--muted);
}
/* Navbar (connecté) : compacte, sans label */
.progress--nav { width: clamp(3rem, 8vw, 5rem); }
.progress--nav .progress__track { height: 4px; }

/* ==========================================================================
   TIMELINE — rail vertical, plus récent en haut
   ========================================================================== */
main { display: block; }
.timeline__stats {
  max-width: var(--wrap);
  margin: clamp(1.5rem, 5vw, 3rem) auto -1rem;
  padding: 0 clamp(1.25rem, 4vw, 2rem);
  font-family: var(--mono);
  font-size: .72rem;
  letter-spacing: .04em;
  color: var(--faint);
  text-align: right;
}
.timeline {
  max-width: var(--wrap);
  margin: clamp(2rem, 6vw, 4rem) auto;
  padding: 0 clamp(1.25rem, 4vw, 2rem);
  position: relative;
}
/* le rail */
.timeline::before {
  content: "";
  position: absolute;
  top: .5rem;
  bottom: 2.5rem;
  left: calc(clamp(1.25rem, 4vw, 2rem) + 3.5px);
  width: 1px;
  background: var(--line);
}

.entry {
  position: relative;
  padding: 1.1rem 0 1.1rem 2rem;
}
.entry + .entry { border-top: 1px solid var(--line); }

.entry__node {
  position: absolute;
  left: -1.5px;
  top: 1.5rem;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--bg);
  border: 1.5px solid var(--faint);
}
.entry--mine .entry__node {
  background: var(--accent);
  border-color: var(--accent);
}

.entry__date {
  display: block;
  font-family: var(--mono);
  font-size: .74rem;
  letter-spacing: .02em;
  color: var(--faint);
  margin-bottom: .3rem;
}
.entry__title {
  display: inline-flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: .6ch;
  font-size: 1.15rem;
  font-weight: 500;
  letter-spacing: -0.01em;
  line-height: 1.3;
}
a.entry__title {
  color: var(--ink);
  text-decoration: none;
  text-underline-offset: 4px;
  text-decoration-thickness: 1px;
  transition: color .16s ease;
}
a.entry__title:hover {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-color: color-mix(in srgb, var(--accent) 55%, transparent);
}
.entry__title--locked {
  color: var(--muted);
  cursor: default;
  font-weight: 400;
}

/* badge brouillon */
.badge {
  font-family: var(--mono);
  font-size: .58rem;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--accent);
  background: var(--accent-soft);
  padding: .28em .6em;
  border-radius: 999px;
  transform: translateY(-1px);
}
/* badge éteint : la lecture unique est déjà consommée */
.badge--muted {
  color: var(--faint);
  background: transparent;
  border: 1px solid var(--line);
}

/* partage unique : action discrète sous le titre, côté auteur */
.entry__share { margin: .4rem 0 0; }
.sharelink {
  font-family: var(--mono);
  font-size: .62rem;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--faint);
  background: transparent;
  border: 0;
  padding: 0;
  cursor: pointer;
  transition: color .16s ease;
}
.sharelink::before { content: "↗ "; }
.sharelink:hover { color: var(--accent); }

/* le post que le cofondateur peut ouvrir — une seule fois */
.entry--locked .entry__title--gift { color: var(--ink); font-weight: 500; }

/* charger plus */
.loadmore {
  display: block;
  margin: 1.75rem auto 0;
  font-family: var(--mono);
  font-size: .78rem;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted);
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: .6em 1.4em;
  cursor: pointer;
  transition: border-color .18s ease, color .18s ease;
}
.loadmore:hover { border-color: var(--ink); color: var(--ink); }

/* ==========================================================================
   FORMULAIRE D'ARTICLE
   ========================================================================== */
.post-form {
  max-width: var(--wrap);
  margin: clamp(2rem, 6vw, 3.5rem) auto;
  padding: 0 clamp(1.25rem, 4vw, 2rem);
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}
.post-form__title {
  font-family: var(--sans);
  font-size: clamp(1.5rem, 4vw, 2.1rem);
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--ink);
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--line);
  padding: .35em 0;
  width: 100%;
}
.post-form__title::placeholder { color: var(--faint); }
.post-form__title:focus { outline: none; border-bottom-color: var(--accent); }

.post-form__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1.25rem;
  font-size: .88rem;
  color: var(--muted);
}
.post-form__date {
  font-family: var(--mono);
  font-size: .85rem;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: .5em .7em;
}
.post-form__date:focus { outline: none; border-color: var(--accent); }
.inline {
  display: inline-flex;
  align-items: center;
  gap: .55ch;
  cursor: pointer;
}
.inline input[type="checkbox"] { accent-color: var(--accent); }
.post-form__image-preview { margin: 0 0 1rem; }
.post-form__image-preview img {
  display: block;
  max-width: 220px;
  height: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.post-form__image-preview figcaption {
  margin-top: .4rem;
  font-size: .78rem;
  color: var(--faint);
}
.post-form__file { font-size: .85rem; color: var(--muted); }
.post-form__file::file-selector-button {
  font-family: var(--sans);
  font-size: .82rem;
  color: var(--muted);
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: .5em .9em;
  margin-right: .8rem;
  cursor: pointer;
}

.post-form__actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1rem;
  padding-top: .5rem;
}
.danger-link {
  margin-left: auto;
  font-size: .85rem;
  color: var(--faint);
  text-decoration: none;
}
.danger-link:hover { color: var(--danger); }

/* Trix — accordé à la charte */
trix-toolbar .trix-button-group {
  border-color: var(--line) !important;
  border-radius: 8px;
}
trix-toolbar .trix-button {
  border-bottom: none;
}
trix-editor {
  min-height: 40vh;
  font-family: var(--sans);
  font-size: 1rem;
  line-height: 1.7;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line) !important;
  border-radius: var(--radius);
  padding: 1.1rem 1.25rem;
}
trix-editor:empty:not(:focus)::before { color: var(--faint); }
trix-editor:focus { outline: none; border-color: var(--accent) !important; }

/* ==========================================================================
   ÉCRANS DE CONFIRMATION (suppression, lecture unique)
   ========================================================================== */
.confirm {
  max-width: 30rem;
  margin: clamp(3rem, 12vh, 6rem) auto;
  padding: 2rem clamp(1.5rem, 5vw, 2.25rem);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
}
.confirm__q {
  margin: 0 0 1.75rem;
  font-size: 1.05rem;
  line-height: 1.5;
}
.confirm__q { margin-bottom: 1rem; }
.confirm__warning {
  margin: 0 0 1.75rem;
  padding-left: .9rem;
  border-left: 2px solid var(--accent);
  font-size: .9rem;
  line-height: 1.55;
  color: var(--muted);
}
.confirm__warning strong { color: var(--ink); }
.confirm__actions {
  display: flex;
  gap: 1rem;
  align-items: center;
}

/* ==========================================================================
   LECTURE UNIQUE — le post s'ouvre une fois, puis se referme
   ========================================================================== */
.read-once {
  max-width: var(--wrap);
  margin: clamp(2rem, 6vw, 3.5rem) auto;
  padding: clamp(1.5rem, 5vw, 2.25rem);
  background: var(--surface);
  border: 1px solid var(--accent);
  border-radius: 14px;
}
.read-once__seal {
  margin: 0 0 1.5rem;
  font-family: var(--mono);
  font-size: .62rem;
  font-weight: 700;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--accent);
}
.read-once__date {
  display: block;
  font-family: var(--mono);
  font-size: .74rem;
  letter-spacing: .02em;
  color: var(--faint);
}
.read-once__title {
  margin: .3rem 0 1.5rem;
  font-size: clamp(1.4rem, 4vw, 1.8rem);
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.2;
}
.read-once__image {
  display: block;
  width: 100%;
  height: auto;
  border-radius: var(--radius);
  margin-bottom: 1.5rem;
}
.read-once__content {
  font-size: 1.02rem;
  line-height: 1.7;
  margin-bottom: 2rem;
}
.read-once__content > *:first-child { margin-top: 0; }
.read-once__content img { max-width: 100%; height: auto; border-radius: var(--radius); }

/* ---- Motion ---------------------------------------------------------------*/
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
  }
}
