/* Rapport expérientiel — viewer markdown (default skin)
   Design façon journalduhacker.net / Lobsters : fond blanc, accent rouge
   bordeaux #ac130d, pastilles de tags jaune pâle, métadonnées grises.

   Palette : les variables :root (clair + sombre) vivent dans la source
   canonique ../shared/tokens.css (servie /shared/tokens.css, copiée
   dist/shared/). Voir docs/DESIGN-SYSTEM.md. */
@import url("../shared/tokens.css");

* { box-sizing: border-box; }

/* ── Smooth transitions for skin/theme changes ── */
body, .top, .audit-sidebar, .preview, .md-prose, a, .nav-links a,
.catalog-nav a, .catalog-nav summary, .skin-toggle, .skin-disable {
  transition: background-color 0.25s ease, color 0.25s ease, border-color 0.25s ease;
}

/* ── Back-to-top FAB ── */
#back-to-top {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--link);
  color: #fff;
  border: none;
  font-size: 20px;
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease;
  z-index: 50;
  box-shadow: 0 2px 8px var(--shadow);
  display: flex;
  align-items: center;
  justify-content: center;
}
#back-to-top.visible {
  opacity: 1;
  pointer-events: auto;
}
#back-to-top:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px var(--shadow);
}

/* ── Hamburger (ouvre le catalogue hors desktop) ── */
.hamburger {
  display: none;
  background: #fff;
  border: 1px solid #ccc;
  color: var(--text);
  font-size: 18px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 4px;
  line-height: 1;
}

/* ── Skip link ── */
.skip-link {
  position: absolute;
  top: -100px;
  left: 8px;
  z-index: 200;
  background: var(--link);
  color: #fff;
  padding: 8px 16px;
  border-radius: 4px;
  font-weight: 600;
  text-decoration: none;
}
.skip-link:focus {
  top: 8px;
}

/* ── Focus indicators ── */
:focus-visible {
  outline: 2px solid var(--link);
  outline-offset: 2px;
}

/* ── Skeleton loading ── */
.skeleton { padding: 20px 0; }
.skeleton-line {
  height: 16px;
  background: var(--code-bg);
  border-radius: 4px;
  margin-bottom: 12px;
  animation: pulse 1.5s ease-in-out infinite;
}
.skeleton-line--title { width: 60%; height: 24px; }
.skeleton-line--short { width: 40%; }
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}
body {
  margin: 0;
  font: 15px/1.55 "Helvetica Neue", Helvetica, Arial, sans-serif;
  color: var(--text);
  background: var(--bg);
}

/* Lecture blog : thème clair sobre (évite contraste cassé dark auto) */
.viewer-shell {
  color-scheme: light;
  --bg: #fff;
  --text: #2f2f35;
  --sidebar-bg: #f7f7f8;
  --sidebar-border: #e5e5e8;
  --top-bg: #fff;
  --top-border: #ececec;
  --muted: #7a7a82;
  --code-bg: #f3f3f4;
  --pre-bg: #f7f7f8;
  --pre-border: #e5e5e8;
  --link: #ac130d;
  --link-visited: #7c2b26;
  --hover-bg: #eef2f7;
  --active-color: #2d5a9e;
  --tag-bg: #fff8d6;
  --tag-border: #e0d48a;
  --tag-color: #555;
  --blockquote-color: #666;
  --blockquote-border: #ddd;
  --table-border: #e5e5e5;
  --table-head-bg: #fafafa;
  --hr-color: #eee;
  --shadow: rgba(0,0,0,0.08);
  background: #fff;
  color: #2f2f35;
}

/* ── Gabarit pages articles ── */

.site-header h1 {
  display: flex;
  align-items: center;
  gap: .5rem;
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
}

.site-header h1 a::before {
  content: "VFG";
  display: inline-block;
  background: #ac130d;
  color: #fff;
  font-size: .68rem;
  font-weight: 700;
  padding: .2rem .35rem;
  border-radius: 3px;
  letter-spacing: .5px;
  margin-right: .5rem;
  vertical-align: .1rem;
}

.site-header .lead {
  font-size: .82rem;
  color: #828282;
  margin: .2rem 0 .45rem;
}

.home-nav {
  display: flex;
  flex-wrap: wrap;
  gap: .9rem;
  font-size: .85rem;
}

.home-nav a {
  color: #828282;
  text-decoration: none;
}

.home-nav a:hover { color: #ac130d; }

.post-meta {
  font-size: .8rem;
  color: #888;
  margin-top: 1.2rem;
  padding-top: .7rem;
  border-top: 1px solid #eee;
}

.post-meta .tag,
.tag {
  font-size: .74rem;
  background: #fffcd7;
  border: 1px solid #d5d458;
  color: #555;
  padding: 0 .4em;
  border-radius: 5px;
  white-space: nowrap;
}

.site-footer {
  margin-top: 1.8rem;
  padding-top: .7rem;
  border-top: 1px solid #eee;
  font-size: .78rem;
  color: #999;
  text-align: center;
}

/* Shell lecture : 2 colonnes stables (fallback si token absent) */
.viewer-shell {
  display: grid;
  grid-template-columns: var(--audit-sidebar, 240px) minmax(0, 1fr);
  align-items: start;
  min-height: 100vh;
  background: var(--bg);
}

.audit-sidebar {
  position: sticky;
  top: 0;
  align-self: start;
  width: var(--audit-sidebar, 240px);
  max-width: 100%;
  height: 100vh;
  overflow-x: hidden;
  overflow-y: auto;
  padding: 14px 12px;
  background: var(--sidebar-bg, #fafafa);
  border-right: 1px solid var(--sidebar-border, #e6e6e6);
  font-size: 13px;
  z-index: 2;
}

.audit-sidebar h2 {
  margin: 0 0 8px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: #666;
}

.audit-sidebar nav a {
  display: block;
  padding: 4px 6px;
  border-radius: 4px;
  color: #1a1a1e;
  text-decoration: none;
}

.audit-sidebar nav a:hover { background: #e8eef6; }
.audit-sidebar nav a.active { background: #e8eef6; color: #2d5a9e; font-weight: 600; }
.audit-sidebar nav a.audit-primary {
  font-weight: 600;
  color: #2d5a9e;
  border-left: 3px solid #4a6fa5;
  padding-left: calc(6px - 3px);
}

.sidebar-meta { font-size: 11px; margin: 0 0 8px; }
.sidebar-meta a { color: #2d5a9e; }

.catalog-search {
  width: 100%;
  margin-bottom: 8px;
  padding: 5px 7px;
  font-size: 12px;
  border: 1px solid #ccc;
  border-radius: 4px;
  background: #fff;
}

.catalog-nav details {
  margin-bottom: 4px;
  border-bottom: 1px solid #eee;
}

.catalog-nav summary {
  cursor: pointer;
  font-weight: 600;
  font-size: 12px;
  padding: 5px 0;
  color: #444;
  list-style: none;
}

.catalog-nav summary::-webkit-details-marker { display: none; }
.catalog-nav summary::before {
  content: "▸ ";
  color: #999;
  font-size: 10px;
}
.catalog-nav details[open] > summary::before { content: "▾ "; }

.catalog-nav a {
  display: block;
  padding: 3px 6px 3px 10px;
  font-size: 12px;
  border-radius: 4px;
  color: #1a1a1e;
  text-decoration: none;
}

.catalog-nav a:hover { background: #e8eef6; }
.catalog-nav a.active { background: #e8eef6; color: #2d5a9e; font-weight: 600; }

.catalog-nav .loading { font-size: 12px; color: #888; }

.content-column {
  min-width: 0;
  position: relative;
  z-index: 1;
  background: var(--bg, #fff);
  isolation: isolate;
}

@media (max-width: 900px) {
  .hamburger { display: inline-flex; align-items: center; justify-content: center; }
  .viewer-shell {
    grid-template-columns: minmax(0, 1fr);
  }
  .audit-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: min(280px, 86vw);
    height: 100vh;
    z-index: 100;
    transform: translateX(-105%);
    transition: transform 0.2s ease;
    box-shadow: none;
    border-right: 1px solid var(--sidebar-border, #e6e6e6);
  }
  body.sidebar-open .audit-sidebar {
    transform: translateX(0);
    box-shadow: 2px 0 16px var(--shadow);
  }
  body.sidebar-open::after {
    content: "";
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.35);
    z-index: 99;
  }
  .content-column {
    width: 100%;
  }
}

.top {
  max-width: min(85vw, 62rem);
  margin: 0 auto;
  padding: 10px 16px;
  background: var(--top-bg);
  color: var(--text);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid var(--top-border);
}

.site-logo {
  display: inline-block;
  background: #ac130d;
  color: #fff;
  font-weight: 700;
  font-size: 11px;
  padding: 3px 5px;
  border-radius: 3px;
  letter-spacing: .5px;
}

.top h1 {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
}

.top h1 a {
  color: #3c3c44;
  text-decoration: none;
}

.nav-links {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  font-size: 13px;
  flex: 1 1 auto;
}

.nav-links a {
  color: #828282;
  text-decoration: none;
}

.nav-links a:hover { color: #ac130d; }

.md-wrap {
  max-width: min(85vw, 62rem);
  margin: 0 auto;
  padding: 16px;
}

.post-title {
  font-size: 1.45rem;
  line-height: 1.3;
  margin: .8rem 0 .2rem;
  color: #3c3c44;
}

.post-subtitle {
  font-size: .95rem;
  color: #666;
  margin: .2rem 0 .3rem;
  line-height: 1.45;
}

.post-byline {
  font-size: .8rem;
  color: #888;
  margin: .2rem 0 1.2rem;
  padding-bottom: .7rem;
  border-bottom: 1px solid #eee;
}

.post-byline .sep { color: #ccc; }

.preview {
  background: var(--bg, #fff);
  border: none;
  padding: 0;
  white-space: normal;
  word-break: break-word;
  color: var(--text, #2f2f35);
  opacity: 1;
}

.viewer-shell .preview {
  background: var(--bg, #fff);
  border: none;
  border-radius: 0;
  padding: 0;
  box-shadow: none;
  color: var(--text, #2f2f35);
}

.md-prose {
  color: var(--text, #2f2f35);
}

.md-prose h1 { font-size: 1.45rem; margin: 1.2em 0 0.5em; line-height: 1.3; }
.md-prose h2 { font-size: 1.2rem; margin: 1.1em 0 0.45em; border-bottom: 1px solid #eee; padding-bottom: 0.2em; }
.md-prose h3 { font-size: 1.05rem; margin: 1em 0 0.4em; }
.md-prose h4 { font-size: 1rem; margin: 0.9em 0 0.35em; }
.md-prose p { margin: 0.65em 0; }
.md-prose ul { margin: 0.5em 0; padding-left: 1.4em; }
.md-prose li { margin: 0.25em 0; }
.md-prose pre {
  background: #f7f7f7;
  border: 1px solid #e5e5e5;
  border-radius: 4px;
  padding: 10px 12px;
  overflow: auto;
  font-size: 13px;
}
.md-prose code {
  font-family: "Cascadia Code", Consolas, monospace;
  font-size: 0.92em;
  background: #f4f4f4;
  padding: 0.1em 0.35em;
  border-radius: 3px;
}
.md-prose pre code { background: none; padding: 0; }
.md-prose a { color: #ac130d; }
.md-prose a:visited { color: #7c2b26; }
.md-prose blockquote {
  margin: 0.8em 0;
  padding: 0.3em 1em;
  border-left: 3px solid #ddd;
  background: none;
  color: #666;
}
.md-prose hr {
  border: none;
  border-top: 1px solid #eee;
  margin: 1.2em 0;
}
.md-prose table { border-collapse: collapse; width: 100%; margin: 0.8em 0; font-size: 13.5px; }
.md-prose th, .md-prose td { border: 1px solid #e5e5e5; padding: 5px 8px; text-align: left; }
.md-prose th { background: #fafafa; }
.md-prose .task-checked { list-style: "✅ "; }
.md-prose .task-unchecked { list-style: "⬜ "; }

.loading { color: #666; font-style: italic; }
.error { color: #9b2226; }

/* Annotatable blocks */
.annotatable {
  cursor: pointer;
  transition: background 0.15s ease;
  border-left: 3px solid transparent;
  padding-left: 6px;
  position: relative;
}

.annotatable:hover {
  background: rgba(26, 115, 232, 0.04);
  border-left-color: #ccc;
}

.annotated {
  border-left-width: 3px;
  border-left-style: solid;
}

.annotated-emoji-yes { border-left-color: #2e7d32; }
.annotated-emoji-x { border-left-color: #c62828; }
.annotated-emoji-pileOfPoo { border-left-color: #e65100; }
.annotated-emoji-wrench { border-left-color: #1565c0; }
.annotated-emoji-star { border-left-color: #f9a825; }
.annotated-emoji-clipboard { border-left-color: #6a1b9a; }
.annotated-emoji-magnifyingGlass { border-left-color: #00838f; }
.annotated-emoji-lightBulb { border-left-color: #fdd835; }
.annotated-emoji-prohibited { border-left-color: #d50000; }

.annotation-badges {
  display: inline-flex;
  gap: 2px;
  margin-left: 4px;
  vertical-align: middle;
}

.annotation-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  font-size: 13px;
  line-height: 1;
  border-radius: 3px;
  cursor: pointer;
  user-select: none;
  vertical-align: middle;
  position: relative;
}

.annotation-tooltip {
  display: none;
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  background: #222;
  color: #fff;
  font-size: 12px;
  padding: 4px 8px;
  border-radius: 4px;
  white-space: nowrap;
  z-index: 100;
  pointer-events: none;
  box-shadow: 0 2px 6px rgba(0,0,0,0.3);
}

.annotation-tooltip::after {
  content: "";
  position: absolute;
  top: 100%;
  left: 50%;
  margin-left: -4px;
  border-width: 4px;
  border-style: solid;
  border-color: #222 transparent transparent transparent;
}

.annotation-badge:hover .annotation-tooltip {
  display: block;
}

.skin-controls {
  display: flex;
  gap: 4px;
  margin-left: auto;
  align-items: center;
  flex-shrink: 0;
}

.skin-disable {
  font: inherit;
  font-size: 11px;
  padding: 4px 8px;
  cursor: pointer;
  border: 1px solid #666;
  background: #333;
  color: #ccc;
  border-radius: 6px;
}

.skin-disable:disabled {
  opacity: 0.45;
  cursor: default;
}

.skin-toggle {
  font: inherit;
  font-size: 12px;
  padding: 3px 9px;
  cursor: pointer;
  border: 1px solid #ccc;
  background: #f7f7f7;
  color: #666;
  border-radius: 5px;
}

.skin-toggle:hover { border-color: #ac130d; color: #ac130d; }

.skin-toggle[aria-pressed="true"] {
  background: #4a6fa5;
  border-color: #6b9fd4;
}

body.skin-skyblog .nav-links a { color: #ffff99; text-shadow: 1px 1px 0 #000; }
body.skin-y2k .nav-links a { color: #0000ff; }
body.skin-weebkawai .nav-links a { color: #ff6b9d; text-decoration: none; }
