/* ============================================================
   Quotidien Optimal — Design System + Motion
   Palette : ivoire chaud / encre marine / dégradé indigo→corail
   ============================================================ */

:root {
  --bg: #faf8f5;
  --bg-soft: #f3efe9;
  --ink: #101828;
  --ink-soft: #475467;
  --ink-faint: #98a2b3;
  --accent: #4f46e5;
  --accent-2: #f97066;
  --accent-3: #fdb022;
  --card: #ffffff;
  --border: #ece7df;
  --radius: 20px;
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, .05);
  --shadow-md: 0 12px 32px -12px rgba(16, 24, 40, .18);
  --shadow-lg: 0 24px 60px -16px rgba(79, 70, 229, .25);
  --font-display: "Fraunces", Georgia, serif;
  --font-body: "Inter", -apple-system, "Segoe UI", sans-serif;
  --ease-out: cubic-bezier(.22, 1, .36, 1);
  --ease-spring: cubic-bezier(.34, 1.56, .64, 1);
}

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

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* Halo animé global (déplacé par JS à la souris) */
body::before {
  content: "";
  position: fixed;
  inset: -20%;
  z-index: -2;
  background:
    radial-gradient(600px 500px at var(--mx, 70%) var(--my, 10%), rgba(79, 70, 229, .10), transparent 60%),
    radial-gradient(500px 420px at calc(100% - var(--mx, 70%)) 80%, rgba(249, 112, 102, .08), transparent 60%);
  transition: background .3s linear;
  pointer-events: none;
}

/* Grain subtil */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  opacity: .35;
  pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2'/%3E%3CfeColorMatrix values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 .035 0'/%3E%3C/filter%3E%3Crect width='120' height='120' filter='url(%23n)'/%3E%3C/svg%3E");
}

::selection { background: rgba(79, 70, 229, .18); }

.c { max-width: 1080px; margin: 0 auto; padding: 0 24px; }

/* ---------- Header ---------- */
header {
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: blur(14px) saturate(1.4);
  -webkit-backdrop-filter: blur(14px) saturate(1.4);
  background: rgba(250, 248, 245, .75);
  border-bottom: 1px solid transparent;
  transition: border-color .3s, box-shadow .3s;
}
header.scrolled { border-bottom-color: var(--border); box-shadow: var(--shadow-sm); }
header .c { display: flex; align-items: center; justify-content: space-between; height: 68px; }

.logo {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 21px;
  color: var(--ink);
  text-decoration: none;
  letter-spacing: -.01em;
  position: relative;
}
.logo::after {
  content: "";
  display: inline-block;
  width: 8px; height: 8px;
  margin-left: 6px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  animation: pulse-dot 2.4s var(--ease-out) infinite;
}
@keyframes pulse-dot {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.5); opacity: .55; }
}

nav { display: flex; gap: 6px; }
nav a {
  position: relative;
  color: var(--ink-soft);
  text-decoration: none;
  font-size: 14.5px;
  font-weight: 500;
  padding: 8px 14px;
  border-radius: 99px;
  transition: color .25s, background .25s, transform .25s var(--ease-spring);
}
nav a:hover { color: var(--ink); background: rgba(79, 70, 229, .08); transform: translateY(-1px); }
nav a[href*="premium"] { color: var(--accent); font-weight: 600; }

/* ---------- Hero ---------- */
.hero {
  position: relative;
  padding: 110px 0 90px;
  overflow: hidden;
}
.hero::before {
  content: "";
  position: absolute;
  top: -180px; left: 50%;
  width: 900px; height: 560px;
  transform: translateX(-50%);
  background: conic-gradient(from 120deg, rgba(79,70,229,.16), rgba(249,112,102,.14), rgba(253,176,34,.10), rgba(79,70,229,.16));
  filter: blur(90px);
  border-radius: 50%;
  animation: aurora 14s linear infinite;
  z-index: -1;
}
@keyframes aurora {
  0% { transform: translateX(-50%) rotate(0deg) scale(1); }
  50% { transform: translateX(-50%) rotate(180deg) scale(1.12); }
  100% { transform: translateX(-50%) rotate(360deg) scale(1); }
}

.hero h1 {
  font-family: var(--font-display);
  font-size: clamp(38px, 6vw, 64px);
  font-weight: 600;
  line-height: 1.06;
  letter-spacing: -.025em;
  max-width: 820px;
}
.hero h1 .word { display: inline-block; overflow: hidden; vertical-align: bottom; }
.hero h1 .word > span { display: inline-block; transform: translateY(110%); animation: rise .9s var(--ease-out) forwards; animation-delay: calc(var(--i) * 55ms + .1s); }
@keyframes rise { to { transform: translateY(0); } }

.hero p {
  margin-top: 26px;
  font-size: clamp(16px, 2vw, 19px);
  color: var(--ink-soft);
  max-width: 620px;
  animation: fade-up .9s var(--ease-out) .5s both;
}
@keyframes fade-up {
  from { opacity: 0; transform: translateY(22px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Indicateur scroll */
.hero .scroll-hint {
  position: absolute;
  left: 50%; bottom: 18px;
  transform: translateX(-50%);
  width: 26px; height: 42px;
  border: 2px solid var(--ink-faint);
  border-radius: 14px;
  animation: fade-up 1s var(--ease-out) 1.2s both;
}
.hero .scroll-hint::before {
  content: "";
  position: absolute;
  top: 7px; left: 50%;
  width: 4px; height: 8px;
  margin-left: -2px;
  border-radius: 4px;
  background: var(--accent);
  animation: scroll-wheel 1.8s var(--ease-out) infinite;
}
@keyframes scroll-wheel {
  0% { transform: translateY(0); opacity: 1; }
  70% { transform: translateY(14px); opacity: 0; }
  100% { transform: translateY(0); opacity: 0; }
}

/* ---------- Sections ---------- */
section { padding: 30px 0; }

h2 {
  font-family: var(--font-display);
  font-size: clamp(26px, 3.4vw, 36px);
  font-weight: 600;
  letter-spacing: -.02em;
  margin: 34px 0 22px;
  display: flex;
  align-items: center;
  gap: 14px;
}
h2::after {
  content: "";
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, var(--border), transparent);
}

/* ---------- Cards ---------- */
.card {
  position: relative;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 30px 32px;
  margin-bottom: 22px;
  box-shadow: var(--shadow-sm);
  transition: transform .45s var(--ease-out), box-shadow .45s var(--ease-out), border-color .3s;
  will-change: transform;
  overflow: hidden;
}
.card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 3px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2), var(--accent-3));
  transform: scaleX(0);
  transform-origin: left;
  transition: transform .5s var(--ease-out);
}
.card:hover { transform: translateY(-6px); box-shadow: var(--shadow-md); border-color: transparent; }
.card:hover::before { transform: scaleX(1); }

.card .tag {
  display: inline-block;
  font-size: 12px;
  font-weight: 650;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--accent);
  background: rgba(79, 70, 229, .09);
  padding: 5px 13px;
  border-radius: 99px;
  margin-bottom: 14px;
  transition: background .3s, color .3s;
}
.card:hover .tag { background: var(--accent); color: #fff; }

.card h3 {
  font-family: var(--font-display);
  font-size: 23px;
  font-weight: 600;
  line-height: 1.25;
  letter-spacing: -.01em;
  margin-bottom: 10px;
}
.card h3 a {
  color: var(--ink);
  text-decoration: none;
  background-image: linear-gradient(currentColor, currentColor);
  background-size: 0% 2px;
  background-repeat: no-repeat;
  background-position: 0 100%;
  transition: background-size .5s var(--ease-out), color .3s;
}
.card h3 a:hover { background-size: 100% 2px; color: var(--accent); }

.card p { color: var(--ink-soft); font-size: 15.5px; }
.card .read { display: inline-block; margin-top: 14px; font-size: 13px; color: var(--ink-faint); font-weight: 500; }

/* Card premium : dégradé animé */
.premium-card {
  color: #fff;
  background: linear-gradient(120deg, #1e1b4b, #4f46e5, #be4a45, #1e1b4b);
  background-size: 300% 300%;
  animation: premium-flow 10s ease infinite;
  border: none;
}
@keyframes premium-flow {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}
.premium-card .tag { background: rgba(255, 255, 255, .18); color: #fff; }
.premium-card:hover .tag { background: #fff; color: var(--accent); }
.premium-card h3 a { color: #fff; }
.premium-card p { color: rgba(255, 255, 255, .82); }

/* ---------- Boutons ---------- */
.btn {
  display: inline-block;
  margin-top: 18px;
  background: #fff;
  color: var(--accent) !important;
  font-weight: 650;
  font-size: 15px;
  padding: 13px 30px;
  border-radius: 99px;
  text-decoration: none;
  box-shadow: 0 6px 20px -6px rgba(0, 0, 0, .35);
  transition: transform .3s var(--ease-spring), box-shadow .3s;
}
.btn:hover { transform: translateY(-3px) scale(1.04); box-shadow: 0 12px 30px -8px rgba(0, 0, 0, .45); }
.btn:active { transform: scale(.97); }

/* ---------- Articles (pages) ---------- */
article, .article-body { max-width: 760px; margin: 0 auto; }
article h1, .article-body h1 {
  font-family: var(--font-display);
  font-size: clamp(30px, 4.5vw, 44px);
  line-height: 1.12;
  letter-spacing: -.02em;
  margin: 50px 0 18px;
}
article h2, .article-body h2 { font-size: clamp(22px, 3vw, 28px); margin: 44px 0 14px; }
article h3, .article-body h3 { font-family: var(--font-display); font-size: 20px; margin: 30px 0 10px; }
article p, .article-body p { margin: 16px 0; color: var(--ink-soft); font-size: 16.5px; }
article ul, article ol, .article-body ul, .article-body ol { margin: 16px 0 16px 24px; color: var(--ink-soft); }
article li, .article-body li { margin: 8px 0; }
article strong, .article-body strong { color: var(--ink); }
article a, .article-body a { color: var(--accent); }
article blockquote, .article-body blockquote {
  border-left: 3px solid var(--accent);
  background: rgba(79, 70, 229, .05);
  border-radius: 0 12px 12px 0;
  padding: 16px 22px;
  margin: 24px 0;
  color: var(--ink-soft);
  font-style: italic;
}

/* Barre de progression de lecture (injectée par JS) */
.reading-progress {
  position: fixed;
  top: 0; left: 0;
  height: 3px; width: 0%;
  z-index: 100;
  background: linear-gradient(90deg, var(--accent), var(--accent-2), var(--accent-3));
  transition: width .1s linear;
}

/* ---------- Reveal on scroll (état initial géré par JS) ---------- */
.reveal { opacity: 0; transform: translateY(34px); transition: opacity .8s var(--ease-out), transform .8s var(--ease-out); transition-delay: var(--d, 0ms); }
.reveal.visible { opacity: 1; transform: translateY(0); }

/* ---------- Footer ---------- */
footer {
  margin-top: 70px;
  padding: 34px 0 44px;
  border-top: 1px solid var(--border);
  color: var(--ink-faint);
  font-size: 14px;
  text-align: center;
}

/* Bouton retour en haut (injecté par JS) */
.back-to-top {
  position: fixed;
  right: 26px; bottom: 26px;
  width: 48px; height: 48px;
  border: none;
  border-radius: 50%;
  background: var(--ink);
  color: #fff;
  font-size: 19px;
  cursor: pointer;
  opacity: 0;
  transform: translateY(16px) scale(.9);
  transition: opacity .35s var(--ease-out), transform .35s var(--ease-spring), background .25s;
  z-index: 90;
  box-shadow: var(--shadow-md);
}
.back-to-top.show { opacity: 1; transform: translateY(0) scale(1); }
.back-to-top:hover { background: var(--accent); transform: translateY(-3px) scale(1.06); }

/* ---------- Accessibilité mouvement ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
  html { scroll-behavior: auto; }
  .reveal { opacity: 1; transform: none; }
}

/* ---------- Responsive ---------- */
@media (max-width: 640px) {
  .hero { padding: 70px 0 64px; }
  .card { padding: 24px 22px; }
  header .c { height: 60px; }
}
