/* =========================================================
   Sociotoolz — couche commune (UI, animations, notifications)
   Chargée après le CSS de chaque page : elle complète, sans casser.
   ========================================================= */

/* L'attribut hidden gagne toujours (corrige pour de bon les animations qui tournaient alors qu'elles devaient être cachées) */
[hidden] { display: none !important; }

html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body { text-rendering: optimizeLegibility; -webkit-font-smoothing: antialiased; }
::selection { background: var(--accent); color: var(--accent-contrast, #fff); }
img, canvas, svg, video { max-width: 100%; }

/* ---- Accessibilité ---- */
.st-skip {
  position: absolute; left: 12px; top: -60px; z-index: 1000;
  background: var(--accent); color: var(--accent-contrast, #fff);
  padding: 10px 16px; border-radius: 10px; font-weight: 600; text-decoration: none;
  transition: top .2s ease;
}
.st-skip:focus { top: 12px; }
:where(a, button, input, textarea, select, summary, [tabindex]):focus-visible {
  outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 10px;
}

/* ---- Navbar collante avec flou ---- */
.navbar {
  position: sticky; top: 0; z-index: 60;
  background: color-mix(in srgb, var(--bg) 84%, transparent);
  -webkit-backdrop-filter: saturate(160%) blur(14px);
  backdrop-filter: saturate(160%) blur(14px);
  transition: box-shadow .25s ease, border-color .25s ease;
  border-bottom: 1px solid transparent;
  border-radius: 0 0 18px 18px;
}
.navbar.st-scrolled { box-shadow: 0 6px 24px -12px var(--shadow); border-bottom-color: var(--border); }
.nav-link { transition: background .2s ease, color .2s ease; text-decoration: none !important; }
.nav-link:hover { color: var(--text); }
.nav-link[aria-current="page"] { background: var(--surface); color: var(--text); box-shadow: 0 1px 2px var(--shadow); }

/* ---- Micro-interactions boutons & cartes ---- */
button, .btn, .btn-solid, .btn-outline, .copy-btn, a.tool-card {
  transition: transform .15s ease, box-shadow .2s ease, background-color .2s ease, border-color .2s ease, color .2s ease, opacity .2s ease;
}
button:not(:disabled):active, .btn-solid:active, .copy-btn:active { transform: scale(.97); }
button:disabled { cursor: not-allowed; opacity: .55; }

/* ---- Barre de progression en haut de page ---- */
.st-progress {
  position: fixed; top: 0; left: 0; height: 3px; width: 0; z-index: 9999;
  background: linear-gradient(90deg, var(--accent), color-mix(in srgb, var(--accent) 45%, #ff8a3d));
  box-shadow: 0 0 10px color-mix(in srgb, var(--accent) 50%, transparent);
  opacity: 0; transition: width .35s ease, opacity .4s ease; pointer-events: none;
}
.st-progress.st-on { opacity: 1; }

/* ---- Notifications (toasts) ---- */
.st-toasts {
  position: fixed; z-index: 9998; bottom: 20px; left: 50%; transform: translateX(-50%);
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  width: min(92vw, 420px); pointer-events: none;
}
.st-toast {
  pointer-events: auto; display: flex; align-items: center; gap: 10px;
  background: var(--text); color: var(--bg);
  padding: 11px 14px 11px 12px; border-radius: 14px; font-size: 14px; font-weight: 500; line-height: 1.35;
  box-shadow: 0 14px 40px -10px rgba(0,0,0,.35);
  animation: st-toast-in .35s cubic-bezier(.2,.9,.3,1.2) both;
  max-width: 100%;
}
.st-toast.st-out { animation: st-toast-out .25s ease forwards; }
.st-toast svg { width: 18px; height: 18px; flex-shrink: 0; }
.st-toast .st-toast-ico { display: inline-flex; width: 26px; height: 26px; border-radius: 999px; align-items: center; justify-content: center; background: rgba(255,255,255,.12); flex-shrink: 0; }
.st-toast.st-success .st-toast-ico { background: #1f9d55; color: #fff; }
.st-toast.st-warn .st-toast-ico { background: #d97706; color: #fff; }
.st-toast.st-hot .st-toast-ico { background: #ea580c; color: #fff; }
.st-toast-close { margin-left: auto; background: none; border: 0; color: inherit; opacity: .6; cursor: pointer; padding: 2px; display: inline-flex; }
.st-toast-close:hover { opacity: 1; }
@keyframes st-toast-in { from { opacity: 0; transform: translateY(14px) scale(.96); } to { opacity: 1; transform: none; } }
@keyframes st-toast-out { to { opacity: 0; transform: translateY(10px) scale(.97); } }

/* ---- Puces de statistiques (vues / utilisations) ---- */
.st-stats { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0 4px; min-height: 30px; }
.st-stat {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12.5px; font-weight: 600; color: var(--text-dim);
  background: var(--surface); border: 1px solid var(--border);
  padding: 6px 11px; border-radius: 999px; white-space: nowrap;
  animation: st-fade-up .4s ease both;
}
.st-stat svg { width: 14px; height: 14px; }
.st-stat b { color: var(--text); font-weight: 700; font-variant-numeric: tabular-nums; }
.st-stat.st-live { color: #c2410c; border-color: color-mix(in srgb, #ea580c 35%, var(--border)); background: color-mix(in srgb, #ea580c 7%, var(--surface)); }
.st-stat.st-live b { color: #c2410c; }
.st-dot { width: 7px; height: 7px; border-radius: 999px; background: #22c55e; box-shadow: 0 0 0 0 rgba(34,197,94,.6); animation: st-pulse 1.8s infinite; }
@keyframes st-pulse { 0% { box-shadow: 0 0 0 0 rgba(34,197,94,.55); } 70% { box-shadow: 0 0 0 8px rgba(34,197,94,0); } 100% { box-shadow: 0 0 0 0 rgba(34,197,94,0); } }
.st-skel {
  display: inline-block; height: 30px; width: 130px; border-radius: 999px;
  background: linear-gradient(90deg, var(--surface-2) 25%, var(--border) 37%, var(--surface-2) 63%);
  background-size: 400% 100%; animation: st-shimmer 1.3s ease infinite;
}
@keyframes st-shimmer { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }

/* ---- Apparition au défilement ---- */
.st-reveal { opacity: 0; transform: translateY(14px); transition: opacity .55s ease, transform .55s cubic-bezier(.2,.8,.2,1); }
.st-reveal.st-in { opacity: 1; transform: none; }
@keyframes st-fade-up { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }


/* ---- Zones de dépôt : chargement, succès, erreur ---- */
.dropzone, .rz-dropzone, .lk-dropzone, .pv-dropzone, [data-st-dz] { position: relative; transition: border-color .2s ease, background-color .2s ease, transform .2s ease, box-shadow .2s ease; }
.st-dz-drag { border-color: var(--accent) !important; background: color-mix(in srgb, var(--accent) 6%, var(--surface-2)) !important; transform: scale(1.01); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 10%, transparent); }
.st-dz-busy { pointer-events: none; }
.st-dz-overlay {
  position: absolute; inset: 0; z-index: 2; border-radius: inherit;
  display: flex; align-items: center; justify-content: center; gap: 14px; padding: 12px 16px; text-align: left;
  background: color-mix(in srgb, var(--surface) 94%, transparent); -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px);
  animation: st-fade-up .2s ease both;
}
.st-dz-ring { position: relative; width: 46px; height: 46px; flex-shrink: 0; }
.st-dz-ring svg { width: 46px; height: 46px; transform: rotate(-90deg); }
.st-dz-ring circle { fill: none; stroke-width: 4; }
.st-dz-track { stroke: var(--border); }
.st-dz-arc { stroke: var(--accent); stroke-linecap: round; stroke-dasharray: 119.4; stroke-dashoffset: 119.4; transition: stroke-dashoffset .15s linear; }
.st-dz-ring::after { content: ""; position: absolute; inset: -3px; border-radius: 50%; border: 2px solid transparent; border-top-color: color-mix(in srgb, var(--accent) 40%, transparent); animation: st-spin .9s linear infinite; }
.st-dz-pct { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 700; color: var(--text); font-variant-numeric: tabular-nums; }
.st-dz-info { min-width: 0; flex: 1; max-width: 300px; }
.st-dz-info strong { display: block; font-size: 14px; color: var(--text); margin: 0 0 2px; }
.st-dz-info small { display: block; font-size: 12px; color: var(--text-dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.st-dz-bar { height: 5px; border-radius: 999px; background: var(--border); overflow: hidden; margin-top: 8px; }
.st-dz-bar span { display: block; height: 100%; width: 0; background: var(--accent); border-radius: 999px; }
@keyframes st-spin { to { transform: rotate(360deg); } }

.st-dz-has-file { font-size: 0 !important; padding: 12px !important; text-align: left !important; }
.st-dz-has-file > :not(.st-dz-done):not(.st-dz-overlay) { display: none !important; }
.st-dz-done { display: flex !important; align-items: center; gap: 12px; font-size: 14px; animation: st-fade-up .3s ease both; }
.st-dz-thumb { width: 54px; height: 54px; border-radius: 12px; object-fit: cover; flex-shrink: 0; background: repeating-conic-gradient(var(--surface-2) 0 25%, var(--border) 0 50%) 0 0 / 12px 12px; border: 1px solid var(--border); }
.st-dz-meta { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.st-dz-meta strong { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; color: #15803d; margin: 0; }
[data-theme="dark"] .st-dz-meta strong { color: #4ade80; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .st-dz-meta strong { color: #4ade80; } }
.st-dz-meta strong svg { width: 16px; height: 16px; }
.st-dz-meta small { font-size: 12px; color: var(--text-dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.st-dz-meta em { font-style: normal; font-size: 11.5px; color: var(--text-dim); opacity: .8; }
.st-dz-ok { border-color: #22c55e !important; border-style: solid !important; box-shadow: 0 0 0 4px rgba(34,197,94,.14); }
.st-dz-error { animation: st-shake .4s ease; border-color: #dc2626 !important; }
@keyframes st-shake { 0%,100% { transform: none; } 25% { transform: translateX(-6px); } 75% { transform: translateX(6px); } }

/* ---- Bouton en cours de traitement ---- */
.st-btn-busy { position: relative; pointer-events: none; opacity: .9 !important; }
.st-btn-spin { display: inline-block; width: 16px; height: 16px; border-radius: 50%; border: 2.5px solid currentColor; border-right-color: transparent; animation: st-spin .7s linear infinite; vertical-align: -3px; margin-right: 8px; }

/* ---- Bouton retour en haut ---- */
.st-backtop {
  position: fixed; right: 18px; bottom: 18px; z-index: 70;
  width: 44px; height: 44px; border-radius: 999px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text); cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  box-shadow: 0 8px 24px -8px var(--shadow);
  opacity: 0; transform: translateY(10px) scale(.9); pointer-events: none;
  transition: opacity .25s ease, transform .25s ease;
}
.st-backtop.st-show { opacity: 1; transform: none; pointer-events: auto; }
.st-backtop svg { width: 18px; height: 18px; }

/* ---- Sections SEO communes (comment ça marche, FAQ, autres outils) ---- */
.st-section { margin-top: 64px; content-visibility: auto; contain-intrinsic-size: auto 600px; }
.st-h2 { font-family: var(--font-display); font-size: clamp(22px, 3vw, 28px); font-weight: 700; letter-spacing: -.01em; margin: 0 0 6px; }
.st-lead { color: var(--text-dim); font-size: 15px; line-height: 1.6; margin: 0 0 22px; max-width: 680px; }
.st-steps { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 12px; counter-reset: st-step; }
.st-step { background: var(--surface); border: 1px solid var(--border); border-radius: 18px; padding: 18px; position: relative; }
.st-step::before {
  counter-increment: st-step; content: counter(st-step);
  display: inline-flex; width: 28px; height: 28px; border-radius: 999px; align-items: center; justify-content: center;
  background: var(--accent); color: var(--accent-contrast, #fff); font-weight: 700; font-size: 13px; margin-bottom: 10px;
}
.st-step h3 { font-size: 15px; margin: 0 0 6px; }
.st-step p { font-size: 13.5px; color: var(--text-dim); line-height: 1.55; margin: 0; }

.st-faq { display: flex; flex-direction: column; gap: 8px; }
.st-faq details { background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 0 18px; transition: border-color .2s ease; }
.st-faq details[open] { border-color: color-mix(in srgb, var(--accent) 35%, var(--border)); }
.st-faq summary {
  cursor: pointer; list-style: none; padding: 16px 28px 16px 0; font-weight: 600; font-size: 15px; position: relative;
}
.st-faq summary::-webkit-details-marker { display: none; }
.st-faq summary::after {
  content: ""; position: absolute; right: 2px; top: 50%; width: 9px; height: 9px;
  border-right: 2px solid var(--text-dim); border-bottom: 2px solid var(--text-dim);
  transform: translateY(-70%) rotate(45deg); transition: transform .25s ease;
}
.st-faq details[open] summary::after { transform: translateY(-30%) rotate(-135deg); }
.st-faq details p { margin: 0 0 16px; color: var(--text-dim); font-size: 14px; line-height: 1.65; }

.st-tools { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; }
.st-tool-link {
  display: flex; align-items: center; gap: 12px; text-decoration: none; color: var(--text);
  background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 14px;
  transition: transform .2s ease, border-color .2s ease, box-shadow .2s ease;
}
.st-tool-link:hover { transform: translateY(-2px); border-color: color-mix(in srgb, var(--accent) 40%, var(--border)); box-shadow: 0 10px 26px -14px var(--shadow); }
.st-tool-link .st-ti { width: 38px; height: 38px; border-radius: 12px; background: var(--accent-soft, var(--surface-2)); display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; }
.st-tool-link .st-ti svg { width: 18px; height: 18px; }
.st-tool-link strong { display: block; font-size: 14px; }
.st-tool-link small { display: block; font-size: 12px; color: var(--text-dim); margin-top: 2px; }

/* ---- Pied de page ---- */
footer.st-footer {
  margin-top: 80px; padding: 34px 0 10px; border-top: 1px solid var(--border);
  text-align: left; font-size: 13px; color: var(--text-dim);
}
.st-footer-grid { display: grid; grid-template-columns: 1.4fr 1fr 1fr; gap: 28px; }
.st-footer h4 { color: var(--text); font-size: 13px; margin: 0 0 10px; }
.st-footer ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 7px; }
.st-footer a { color: var(--text-dim); text-decoration: none; }
.st-footer a:hover { color: var(--text); }
.st-footer .st-brand { font-weight: 700; color: var(--text); font-size: 16px; margin-bottom: 8px; display: block; }
.st-footer p { margin: 0 0 8px; line-height: 1.6; max-width: 340px; }
.st-footer-bottom { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 10px; margin-top: 26px; padding-top: 16px; border-top: 1px solid var(--border); font-size: 12px; }
@media (max-width: 720px) { .st-footer-grid { grid-template-columns: 1fr 1fr; } .st-footer-grid > :first-child { grid-column: 1 / -1; } }

/* ---- Mini-convertisseur des pages de style ---- */
.st-mini { background: var(--surface); border: 1px solid var(--border); border-radius: 22px; padding: 18px; margin: 8px 0 26px; box-shadow: 0 10px 34px -22px var(--shadow); }
.st-mini label { font-size: 12px; font-weight: 600; color: var(--text-dim); display: block; margin-bottom: 8px; }
.st-mini textarea {
  width: 100%; box-sizing: border-box; min-height: 96px; resize: vertical;
  font: inherit; font-size: 17px; line-height: 1.45; color: var(--text);
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 14px; padding: 12px 14px;
}
.st-mini-out {
  margin-top: 12px; display: flex; gap: 10px; align-items: stretch;
}
.st-mini-result {
  flex: 1; min-height: 52px; font-size: 20px; line-height: 1.45; word-break: break-word;
  background: var(--bg); border: 1px dashed var(--border); border-radius: 14px; padding: 12px 14px;
}
.st-mini-copy {
  border: 0; border-radius: 14px; padding: 0 18px; font: inherit; font-weight: 600; cursor: pointer;
  background: var(--accent); color: var(--accent-contrast, #fff); display: inline-flex; align-items: center; gap: 8px; white-space: nowrap;
}
.st-mini-copy svg { width: 16px; height: 16px; }
.st-mini-meta { margin-top: 8px; font-size: 12px; color: var(--text-dim); display: flex; justify-content: space-between; }
@media (max-width: 560px) { .st-mini-out { flex-direction: column; } .st-mini-copy { padding: 12px 18px; justify-content: center; } }


/* ---- Pages de style : fil d'Ariane, exemples, styles proches ---- */
.st-crumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: 13px; color: var(--text-dim); margin: 0 0 18px; }
.st-crumbs a { color: var(--text-dim); text-decoration: none; }
.st-crumbs a:hover { color: var(--text); text-decoration: underline; }
.st-crumbs [aria-current] { color: var(--text); font-weight: 600; }
.st-mini-copy.copied { background: #1f9d55; color: #fff; }
.st-examples { display: grid; gap: 8px; }
.st-ex { display: grid; grid-template-columns: minmax(120px, 0.8fr) 1.6fr auto; align-items: center; gap: 14px; background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 12px 12px 12px 16px; }
.st-ex-src { font-size: 13px; color: var(--text-dim); }
.st-ex-out { font-size: 19px; word-break: break-word; }
.st-ex-copy { width: 38px; height: 38px; border-radius: 12px; border: 1px solid var(--border); background: var(--surface-2); color: var(--text); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; }
.st-ex-copy svg { width: 16px; height: 16px; }
.st-ex-copy.copied { background: #1f9d55; border-color: #1f9d55; color: #fff; }
@media (max-width: 560px) { .st-ex { grid-template-columns: 1fr auto; } .st-ex-src { grid-column: 1 / -1; } }
.st-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.st-chip { display: inline-flex; align-items: center; gap: 8px; text-decoration: none; color: var(--text); background: var(--surface); border: 1px solid var(--border); border-radius: 999px; padding: 8px 14px; font-size: 13px; font-weight: 600; transition: border-color .2s ease, transform .2s ease; }
.st-chip span { font-weight: 400; color: var(--text-dim); }
.st-chip:hover { border-color: var(--accent); transform: translateY(-1px); }

/* ---- Page publique (ex. page de liens d'un utilisateur) : pas de contenu marketing ---- */
.st-public .st-seo, .st-public .ad-slot { display: none !important; }

/* ---- Hors ligne ---- */
.st-offline-flag { position: fixed; top: 10px; left: 50%; transform: translateX(-50%); z-index: 9997; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
  .st-reveal { opacity: 1; transform: none; }
}
@media print { .navbar, .st-backtop, .st-toasts, .ad-slot, footer { display: none !important; } }
