/* ============================================================================
   SOCIALNEST — styles des flux linkgram (build / social) · v12
   ----------------------------------------------------------------------------
   Ces règles vivaient dans des fragments échangés par HTMX. Chaque swap
   réinjectait le bloc <style> et forçait un nouveau calcul de style ; sur le
   wizard de build, à chaque étape. Elles sont désormais chargées une fois par
   la page parente.

   Chargé par : linkgram/build.html, linkgram/edit.html
   ========================================================================== */

/* ---------------------------------------------- build_step
   source : templates/linkgram/_build_step.html
   Migré du v11 sombre (accent lime, blanc translucide) vers les jetons v13. */
.bd-card {
    background:var(--card); border:1px solid var(--line);
    border-radius:var(--r-card); padding:16px; margin-bottom:12px; box-shadow:var(--shadow);
  }
  .bd-id { display:flex; align-items:center; gap:13px; }
  .bd-av {
    width:56px; height:56px; border-radius:50%; flex-shrink:0;
    background-size:cover; background-position:center; background-color: var(--surface-2);
  }
  .bd-av-empty { display:grid; place-items:center; font-family:var(--font-d); font-size:1.3rem; font-weight:700; color: var(--ink); background:var(--accent-soft); }
  .bd-name { font-family:var(--font-d); font-size:1rem; font-weight:700; color: var(--ink); }
  .bd-niche { font-size:.75rem; color: var(--ink-mute); margin-top:2px; }
  .bd-nets { display:flex; flex-direction:column; gap:6px; margin-top:14px; }
  .bd-net { display:flex; align-items:center; gap:9px; font-size:.75rem; }
  .bd-net.dim { opacity:.6; }
  .bd-net-p { color: var(--ink-mute); min-width:74px; }
  .bd-net-h { color: var(--ink); font-weight:600; }
  .bd-net-f { margin-left:auto; color:var(--accent); font-weight:700; }
  .bd-net-f.warn { color:var(--g-red); font-weight:500; }
  .bd-posts { display:grid; grid-template-columns:repeat(4,1fr); gap:5px; margin-top:14px; }
  .bd-post {
    aspect-ratio:3/4; border-radius:8px; background-size:cover; background-position:center;
    background-color: var(--surface-2); display:block;
  }
  .bd-publish {
    width:100%; margin-top:16px; min-height:44px; padding:0 13px; border-radius:var(--r-btn); border:0; cursor:pointer;
    background:var(--accent); color:#fff; font-family:var(--font-d); font-size:.95rem; font-weight:600;
  }
  [data-theme="dark"] .bd-publish { color:#16255C; }
  .bd-publish:active { transform:scale(.98); }

/* ---------------------------------------------- build_done
   source : templates/linkgram/_build_done.html
   Le bloc de récupération (bd-claim*/bd-esc*/bd-ok/bd-err) a été retiré : il est
   remplacé par le composant partagé _recovery.html (primitives v13). Ne restent
   ici que le bouton de partage, migré sur les jetons. */
  .bd-share {
    width: 100%; margin-top: 14px; min-height: 48px; padding: 0 15px; border-radius: var(--r-btn);
    border: 0; cursor: pointer; display: flex; align-items: center;
    justify-content: center; gap: 9px;
    background: var(--accent); color: #fff; font-family:var(--font-d); font-size: 1rem; font-weight: 600;
  }
  [data-theme="dark"] .bd-share { color:#16255C; }
  .bd-share:active { transform: scale(.98); }
  .bd-share-i { font-size: 17px; }
  .bd-share.done { background: var(--g-green); color: #FFF; }

/* ---------------------------------------------- social_list
   source : templates/linkgram/_social_list.html */
/* 26×20px, c'était indéfendable. Le bouton follow de TikTok est minuscule ET
     ultra-familier : on le vise de mémoire. Une flèche de réordonnancement, on la
     vise trois fois dans sa vie. Elle n'a pas ce crédit. */
  .sl-arrow { width: 34px !important; height: 30px !important; font-size: 13px !important; }
  .sl-del   { width: 38px !important; height: 38px !important; }
  .sl-row   { padding: 10px 11px !important; }

/* ============================================================================
   ÉDITEUR « MA PAGE » — liens et apparence · v12
   ----------------------------------------------------------------------------
   Conçu pour le pouce : chaque rangée fait 64 px, chaque contrôle 44 px, les
   champs 16 px (en dessous, iOS zoome au focus et décale la page).
   ========================================================================== */

/* ------------------------------------------------------------ liste liens */
.lk-list { list-style: none; margin: 0 0 12px; padding: 0; }
.lk + .lk { margin-top: 8px; }

.lk-d { border: 1px solid var(--app-border); border-radius: 16px; background: var(--app-surface-2); overflow: hidden; }
.lk-d[open] { border-color: var(--app-accent-2); }

.lk-sum {
  display: flex; align-items: center; gap: 11px;
  min-height: 72px; padding: 10px 12px;
  cursor: pointer; list-style: none; user-select: none;
}
.lk-sum::-webkit-details-marker { display: none; }
.lk-sum:hover { background: var(--surface-2); }

.lk-thumb {
  width: 44px; height: 44px; flex: none; border-radius: 11px;
  background-size: cover; background-position: center;
  background-color: var(--app-surface-3);
}
.lk-thumb--none { display: grid; place-items: center; color: var(--app-faint); background-image: none !important; }

.lk-b { flex: 1; min-width: 0; }
.lk-t {
  display: block; font-size: 14px; font-weight: 600; line-height: 1.3;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.lk-off {
  font-style: normal; font-size: 10px; font-weight: 800; text-transform: uppercase;
  letter-spacing: .05em; color: var(--app-faint);
  border: 1px solid var(--app-border); border-radius: 4px; padding: 1px 5px; margin-left: 4px;
}
.lk-m {
  display: block; margin-top: 2px; font-size: 11.5px; color: var(--app-muted);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

.lk-ord { display: flex; flex-direction: column; gap: 2px; flex: none; }
/* Deux flèches empilées : 34px chacune, soit 68px de colonne pour une rangée
   de 72px. À 22px — la première version — la cible était deux fois trop
   petite pour un pouce, et un réordonnancement raté sur mobile se solde par
   un dépliage de fiche non voulu. */
.lk-arrow {
  width: 36px; height: 34px; display: grid; place-items: center;
  background: none; border: 0; color: var(--app-faint); cursor: pointer; border-radius: 8px;
}
.lk-arrow:hover { color: var(--app-text); background: var(--app-surface-3); }
.lk-chev { flex: none; color: var(--app-faint); font-size: 19px; transition: transform .2s; }
.lk-d[open] .lk-chev { transform: rotate(90deg); }

/* ------------------------------------------------------------ fiche lien */
.lk-form { padding: 4px 14px 14px; border-top: 1px solid var(--app-border); }
.lk-in {
  width: 100%; padding: 12px 14px; margin-bottom: 4px;
  background: var(--app-bg); border: 1px solid var(--app-border);
  border-radius: 12px; color: var(--app-text);
  font-size: 16px; font-family: inherit;      /* 16 px : pas de zoom iOS */
}
.lk-in:focus { outline: none; border-color: var(--app-accent-2); }
.lk-in--url { font-size: 16px; }

.lk-img { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; }
.lk-img-prev {
  width: 62px; height: 62px; flex: none; border-radius: 12px;
  background-size: cover; background-position: center;
  background-color: var(--app-surface-3);
  display: grid; place-items: center; color: var(--app-faint);
}
.lk-img-act { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; }

.lk-file {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 44px; padding: 0 16px; border-radius: 62rem; cursor: pointer;
  background: var(--app-surface-3); border: 1px solid var(--app-border);
  color: var(--app-text); font-size: 13px; font-weight: 700; text-align: center;
}
.lk-file:hover { border-color: var(--app-accent-2); }
.lk-file--wide { width: 100%; margin-bottom: 10px; }
.lk-file span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.lk-rm { display: flex; align-items: center; gap: 7px; min-height: 44px;
          font-size: 12px; color: var(--app-muted); cursor: pointer; }
.lk-rm input { width: 17px; height: 17px; accent-color: var(--app-red); }

.lk-styles { display: flex; flex-wrap: wrap; gap: 7px; margin-bottom: 6px; }
.lk-style {
  min-height: 40px; display: inline-flex; align-items: center; padding: 0 14px;
  border-radius: 62rem; cursor: pointer;
  background: var(--app-surface-3); border: 1px solid var(--app-border);
  font-size: 12.5px; font-weight: 700; color: var(--app-muted);
}
.lk-style.on { background: var(--app-accent); border-color: var(--app-accent); color: var(--app-accent-ink); }

.lk-toggle {
  display: flex; align-items: center; gap: 10px;
  min-height: 44px; padding: 6px 0; cursor: pointer;
  font-size: 13.5px; border-bottom: 1px solid var(--app-border);
}
.lk-toggle input[type=checkbox] { width: 19px; height: 19px; accent-color: var(--app-accent); flex: none; }

.lk-save { margin-top: 12px; }
.lk-delform { padding: 0 14px 14px; }
.lk-del {
  width: 100%; min-height: 44px; border-radius: 62rem; cursor: pointer;
  background: none; border: 1px solid rgba(248,113,113,.42);
  color: var(--app-red); font-size: 13px; font-weight: 700;
}
.lk-del:hover { background: rgba(248,113,113,.10); }

.lk-empty {
  padding: 22px 16px; text-align: center; font-size: 13px; color: var(--app-muted);
  border: 1px dashed var(--app-border); border-radius: 14px;
}

.lk-add { margin-bottom: 10px; }
.lk-add-sum {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 46px; border-radius: 62rem; cursor: pointer; list-style: none;
  background: var(--app-surface-2); border: 1px dashed var(--app-border);
  font-size: 13.5px; font-weight: 700; color: var(--app-text);
}
.lk-add-sum::-webkit-details-marker { display: none; }
.lk-add[open] .lk-add-sum { border-style: solid; border-color: var(--app-accent-2); margin-bottom: 10px; }
.lk-opt { font-weight: 500; color: var(--app-faint); }

.lk-assist {
  width: 100%; min-height: 42px; margin-top: 4px; border: 0; cursor: pointer;
  background: none; color: var(--app-accent-2); font-size: 12.5px; font-weight: 700;
  display: flex; align-items: center; justify-content: center; gap: 7px;
}

/* --------------------------------------------------------- habillages */
/* Aperçu miniature plutôt que pastille dégradée : le créateur voit la
   structure de sa page — titre, sous-titre, bouton — pas deux couleurs. */
.sk-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
@media (min-width: 560px) { .sk-grid { grid-template-columns: repeat(5, 1fr); } }

.sk {
  padding: 0; border: 2px solid transparent; border-radius: 13px;
  background: none; cursor: pointer; overflow: hidden; text-align: center;
}
.sk.on { border-color: var(--app-accent); }
.sk-prev {
  display: block; padding: 11px 9px; border-radius: 10px;
  background: var(--sk-bg); border: 1px solid var(--app-border);
}
.sk-bar { display: block; height: 5px; border-radius: 3px; background: var(--sk-tx); opacity: .85; }
.sk-bar--s { width: 62%; margin: 5px auto 8px; opacity: .45; }
.sk-cta { display: block; height: 12px; border-radius: 62rem; background: var(--sk-ac); }
.sk-n {
  display: block; margin-top: 5px; font-size: 10.5px; font-weight: 700;
  color: var(--app-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.sk.on .sk-n { color: var(--app-text); }

.sk-custom { margin-top: 14px; }
.sk-custom-sum {
  display: flex; align-items: center; gap: 8px; min-height: 44px;
  cursor: pointer; list-style: none; font-size: 13px; font-weight: 700; color: var(--app-accent-2);
}
.sk-custom-sum::-webkit-details-marker { display: none; }

.sk-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 12px; }
.sk-col { display: block; }
.sk-col input[type=color] {
  width: 100%; height: 46px; padding: 0; cursor: pointer;
  background: none; border: 1px solid var(--app-border); border-radius: 12px;
}

.sk-live {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 14px 16px; border-radius: 14px;
  background: var(--sk-bg, #0E0E10); border: 1px solid var(--app-border);
}
.sk-live-t { font-size: 12px; font-weight: 700; color: var(--app-faint); }
.sk-live-btn {
  padding: 9px 18px; border-radius: 62rem;
  background: var(--sk-ac, #E3F331); color: #0E0E10;
  font-size: 12.5px; font-weight: 800;
}

/* ============================================================================
   RÉSEAUX SOCIAUX — une rangée, une ligne
   ----------------------------------------------------------------------------
   La version précédente empilait flèches, sélecteur, champ, bouton
   « Enregistrer » et croix sur quatre lignes : trois réseaux remplissaient
   l'écran. Tout tient désormais sur une ligne, l'enregistrement est
   automatique, et la poignée sert au glisser-déposer.
   ========================================================================== */
.sl-wrap { display: flex; flex-direction: column; gap: 8px; }

.sl-row {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 8px; min-height: 56px;
  background: var(--card); border: 1px solid var(--line); border-radius: 12px;
}
.sl-row.is-dragging {
  opacity: .92; box-shadow: var(--shadow-lg);
  border-color: var(--accent); cursor: grabbing;
}

.sl-grip {
  flex: none; width: 32px; height: 40px; display: grid; place-items: center;
  background: none; border: 0; cursor: grab; color: var(--ink-mute);
  border-radius: 8px;
  /* Le navigateur nous laisse le geste ICI et nulle part ailleurs : la page
     continue de défiler normalement partout ailleurs dans la liste. */
  touch-action: none;
}
.sl-grip:hover { background: var(--surface-2); color: var(--ink); }
.sl-grip:active { cursor: grabbing; }

.sl-form { flex: 1; min-width: 0; display: flex; align-items: center; gap: 7px; }
.sl-ico { flex: none; width: 26px; height: 26px; display: grid; place-items: center;
          border-radius: 7px; background: var(--surface-2); color: var(--ink-mute); }
.sl-select {
  flex: none; width: 118px; min-height: 40px; padding: 0 8px;
  border: 1px solid var(--line); border-radius: 9px;
  background: var(--card); color: var(--ink); font-family: inherit;
}
.sl-input {
  flex: 1; min-width: 0; min-height: 40px; padding: 0 11px;
  border: 1px solid var(--line); border-radius: 9px;
  background: var(--card); color: var(--ink); font-family: inherit;
  text-overflow: ellipsis;
}
.sl-input:focus, .sl-select:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.sl-move { display: flex; flex-direction: column; gap: 1px; flex: none; }
.sl-arrow {
  width: 30px; height: 20px; display: grid; place-items: center;
  background: none; border: 0; cursor: pointer; color: var(--ink-mute); border-radius: 5px;
}
.sl-arrow:hover:not(:disabled) { background: var(--surface-2); color: var(--ink); }
.sl-arrow:disabled { opacity: .28; cursor: default; }

.sl-del {
  flex: none; width: 40px; height: 40px; display: grid; place-items: center;
  background: none; border: 0; cursor: pointer; color: var(--ink-mute); border-radius: 9px;
}
.sl-del:hover { background: rgba(234,67,53,.10); color: var(--g-red); }

.sl-empty {
  padding: 18px; text-align: center; font-size: 13px; color: var(--ink-mute);
  border: 1px dashed var(--line); border-radius: 12px;
}
.sl-add { display: flex; align-items: center; gap: 7px; margin-top: 4px; }
.sl-addbtn {
  flex: none; min-height: 40px; padding: 0 15px; border-radius: 9px; cursor: pointer;
  background: var(--accent); color: #fff; border: 0;
  font-family: var(--font-d); font-weight: 600; font-size: 13px;
}
[data-theme="dark"] .sl-addbtn { color: #16255C; }
.sl-hint { margin-top: 8px; font-size: 11.5px; color: var(--ink-mute); }

/* Sous 520px la ligne devient deux lignes plutôt que d'écraser le champ. */
@media (max-width: 520px) {
  .sl-row { flex-wrap: wrap; padding: 8px; }
  .sl-form { order: 3; width: 100%; flex-basis: 100%; }
  .sl-select { width: 104px; }
}
