/* ===========================================================================
   Preferences d'affichage : themes supplementaires, densite, taille du texte,
   mouvement reduit, contraste, medias et mode streamer (voir js/lib/prefs.js).
   =========================================================================== */

html { font-size: calc(14px * var(--font-scale, 1)); }
html, body { font-size: calc(14px * var(--font-scale, 1)); }
.msg-content { line-height: var(--line-height, 1.55); }

/* ---- themes (13.2) : memes jetons que gruvbox, autres palettes ---- */
[data-theme="nord"] {
  --primary: #88c0d0; --primary-hover: #8fbcbb; --bg: #2e3440; --bg-elevated: #3b4252; --surface: #434c5e;
  --surface-hover: #4c566a; --text: #eceff4; --text-secondary: #d8dee9; --text-muted: #7b88a1; --sidebar-bg: #272c36;
  --panel-bg: #3b4252; --border: #434c5e; --gb-red: #bf616a; --gb-green: #a3be8c; --gb-yellow: #ebcb8b;
  --gb-blue: #81a1c1; --gb-purple: #b48ead; --gb-aqua: #8fbcbb; --gb-orange: #d08770;
}
[data-theme="solarized"] {
  --primary: #b58900; --primary-hover: #cb4b16; --bg: #002b36; --bg-elevated: #073642; --surface: #0b4250;
  --surface-hover: #13505f; --text: #eee8d5; --text-secondary: #93a1a1; --text-muted: #657b83; --sidebar-bg: #00212b;
  --panel-bg: #073642; --border: #0b4250; --gb-red: #dc322f; --gb-green: #859900; --gb-yellow: #b58900;
  --gb-blue: #268bd2; --gb-purple: #6c71c4; --gb-aqua: #2aa198; --gb-orange: #cb4b16;
}
[data-theme="dracula"] {
  --primary: #bd93f9; --primary-hover: #ff79c6; --bg: #282a36; --bg-elevated: #303241; --surface: #3a3c4e;
  --surface-hover: #44475a; --text: #f8f8f2; --text-secondary: #c9c9d9; --text-muted: #7c7f99; --sidebar-bg: #21222c;
  --panel-bg: #303241; --border: #3a3c4e; --gb-red: #ff5555; --gb-green: #50fa7b; --gb-yellow: #f1fa8c;
  --gb-blue: #8be9fd; --gb-purple: #bd93f9; --gb-aqua: #8be9fd; --gb-orange: #ffb86c;
}
[data-theme="tokyo"] {
  --primary: #7aa2f7; --primary-hover: #bb9af7; --bg: #1a1b26; --bg-elevated: #1f2335; --surface: #292e42;
  --surface-hover: #33394f; --text: #c0caf5; --text-secondary: #a9b1d6; --text-muted: #565f89; --sidebar-bg: #16161e;
  --panel-bg: #1f2335; --border: #292e42; --gb-red: #f7768e; --gb-green: #9ece6a; --gb-yellow: #e0af68;
  --gb-blue: #7aa2f7; --gb-purple: #bb9af7; --gb-aqua: #7dcfff; --gb-orange: #ff9e64;
}
/* Contraste eleve (13.5) : noir, blanc et jaune, bordures franches. */
[data-theme="contrast"] {
  --primary: #ffff00; --primary-hover: #ffffff; --bg: #000000; --bg-elevated: #000000; --surface: #1a1a1a;
  --surface-hover: #333333; --text: #ffffff; --text-secondary: #ffffff; --text-muted: #d0d0d0; --sidebar-bg: #000000;
  --panel-bg: #000000; --border: #ffffff; --gb-red: #ff6b6b; --gb-green: #7dff7d; --gb-yellow: #ffff00;
  --gb-blue: #7fd4ff; --gb-purple: #ff9cff; --gb-aqua: #7dffff; --gb-orange: #ffb347;
}
[data-theme="contrast"] a { text-decoration: underline; }
[data-theme="contrast"] .scanlines, [data-theme="contrast"] .shell::after { display: none !important; }

/* ---- densite (13.3) ---- */
[data-density="compact"] .msg { padding-top: 0; padding-bottom: 0; gap: 8px; }
[data-density="compact"] .msg .msg-gutter .avatar { width: 22px !important; height: 22px !important; font-size: 10px; }
[data-density="compact"] .msg-head { display: inline-flex; margin-right: 8px; }
[data-density="compact"] .msg:not(.grouped) .msg-body { display: block; }
[data-density="compact"] .msg-head + .msg-content { display: inline; }
[data-density="compact"] .chan { padding-top: 3px; padding-bottom: 3px; }
[data-density="compact"] .day-sep { margin: 4px 18px; }
[data-density="spacious"] .msg { padding-top: 6px; padding-bottom: 6px; }
[data-density="spacious"] .msg.grouped { padding-top: 3px; }

/* ---- mouvement reduit (13.5) ---- */
[data-motion="reduced"] *, [data-motion="reduced"] *::before, [data-motion="reduced"] *::after {
  animation-duration: 0.001ms !important; animation-iteration-count: 1 !important;
  transition-duration: 0.001ms !important; scroll-behavior: auto !important;
}

/* ---- focus visible pour la navigation clavier (13.5) ---- */
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.skip-link {
  position: fixed; left: 8px; top: -60px; z-index: 1000; padding: 8px 14px;
  background: var(--primary); color: var(--bg); font-weight: 700; transition: top .15s;
}
.skip-link:focus { top: 8px; }
.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* ---- medias et liens (13.18) ---- */
[data-underline="on"] .msg-content a { text-decoration: underline; }
.attachment-img, .attachment-media, .embed-image, .embed-thumbnail { filter: saturate(var(--media-saturation, 1)); }
.alt-caption { display: none; font-size: 11px; color: var(--text-muted); margin-top: 3px; }
[data-alt="on"] .alt-caption { display: block; }

/* ---- mode streamer (13.8) : informations personnelles floutees ---- */
[data-streamer="on"] .streamer-hide { filter: blur(6px); transition: filter .15s; }
[data-streamer="on"] .streamer-hide:hover { filter: none; }
.streamer-badge {
  display: none; position: fixed; right: 12px; top: 8px; z-index: 900; padding: 3px 10px;
  background: var(--gb-purple); color: var(--bg); font-size: 10px; font-weight: 700; letter-spacing: 1px;
}
[data-streamer="on"] .streamer-badge { display: block; }
