:root {
  --bg: #f6f5f1;
  --fg: #1f2328;
  --muted: #5d636b;
  --card: #ffffff;
  --border: #dcdad3;
  --accent: #7a3e9d;
  --ferme: #b3261e;
  --partiel: #b86e00;
  --sans-retour: #2c6fbb;
  --open: #2e7d32;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #16181b;
    --fg: #e7e7e4;
    --muted: #a0a4aa;
    --card: #202328;
    --border: #353941;
    --accent: #c79be6;
    --ferme: #f2877f;
    --partiel: #f0b35a;
    --sans-retour: #83b4ee;
    --open: #7fca84;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--fg);
  line-height: 1.5;
}

a { color: var(--accent); }

.bandeau {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  padding: 0.75rem max(1rem, calc((100% - 72rem) / 2 + 1.5rem));
  background: #fff;
  color: #161616;
  border-bottom: 1px solid var(--border);
  box-shadow: 0 2px 6px rgba(0, 0, 18, 0.12);
}
.bandeau-logo { display: block; line-height: 0; }
.bandeau-logo img { width: 99px; height: auto; }
.bandeau-service p { margin: 0; }
.bandeau-titre { font-weight: 700; font-size: 1.25rem; }
.bandeau-baseline { color: #3a3a3a; font-size: 0.9rem; }
.bandeau-communs {
  margin-left: auto;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.6rem;
}
.bandeau-communs a { display: block; line-height: 0; border-radius: 50%; }
.bandeau-communs a:hover { opacity: 0.8; }
.bandeau-communs img { width: 36px; height: 36px; }
.bandeau-communs .logo-large { border-radius: 0; }
.bandeau-communs .logo-large img { width: auto; height: 29px; }
@media (max-width: 30rem) {
  .bandeau { gap: 1rem; }
  .bandeau-logo img { width: 76px; }
  .bandeau-communs { gap: 0.4rem; max-width: 7.5rem; }
  .bandeau-communs img { width: 28px; height: 28px; }
  .bandeau-communs .logo-large img { height: 22px; }
}

.hero {
  position: relative;
  padding: 5rem max(1.5rem, calc((100% - 60rem) / 2)) 3.5rem;
  min-height: 24rem;
  color: #fff;
  background:
    linear-gradient(90deg, rgba(10, 14, 20, 0.82) 0%, rgba(10, 14, 20, 0.6) 55%, rgba(10, 14, 20, 0.25) 100%),
    url("../img/fond-silos.jpg") center 35% / cover no-repeat #3b4a3a;
}
.hero-contenu { max-width: 42rem; }
.hero h1 {
  font-size: clamp(2.2rem, 6vw, 3.5rem);
  margin: 0 0 0.5rem;
  letter-spacing: -0.02em;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}
.hero h1 span { color: #e6c35c; }
.tagline { font-size: 1.15rem; margin: 0 0 0.75rem; }
.example { color: rgba(255, 255, 255, 0.85); margin: 0; }
.credit-photo {
  position: absolute;
  right: 0.75rem;
  bottom: 0.5rem;
  margin: 0;
  font-size: 0.75rem;
  color: rgba(255, 255, 255, 0.8);
}
.credit-photo a { color: inherit; }
@media (max-width: 40rem) {
  .hero {
    padding-top: 3rem;
    min-height: 0;
    background:
      linear-gradient(rgba(10, 14, 20, 0.72), rgba(10, 14, 20, 0.72)),
      url("../img/fond-silos.jpg") center 35% / cover no-repeat #3b4a3a;
  }
  .credit-photo { position: static; margin-top: 1.5rem; }
}

main {
  max-width: 72rem;
  margin: 0 auto;
  padding: 0 1.5rem 3rem;
}

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  position: sticky;
  top: 0;
  background: var(--bg);
  padding: 0.75rem 0;
  z-index: 1;
}
.filters input, .filters select {
  font: inherit;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--card);
  color: var(--fg);
}
.filters input { flex: 1 1 18rem; }
.vue-toggle {
  font: inherit;
  padding: 0.5rem 0.9rem;
  border: 1px solid var(--accent);
  border-radius: 6px;
  background: var(--card);
  color: var(--accent);
  font-weight: 600;
  cursor: pointer;
}
.vue-toggle:hover { background: var(--accent); color: var(--bg); }

.count { color: var(--muted); margin: 0.5rem 0 1rem; }

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(20rem, 1fr));
  gap: 1rem;
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
}
.card h3 { margin: 0; font-size: 1.25rem; }
.card h3 a { color: var(--fg); text-decoration: none; }
.card h3 a:hover { text-decoration: underline; }
.card p { margin: 0.5rem 0; }
.operateur { color: var(--muted); font-size: 0.9rem; margin: 0.15rem 0 0.5rem !important; }

.tags { display: flex; flex-wrap: wrap; gap: 0.35rem; }
.tag, .badge {
  font-size: 0.75rem;
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  white-space: nowrap;
}
.tag { color: var(--muted); }
.badge { font-weight: 600; border-color: currentColor; }
.badge.fermé { color: var(--ferme); }
.badge.partiel { color: var(--partiel); }
.badge.ouvert-sans-retour { color: var(--sans-retour); }

.probleme {
  border-left: 3px solid var(--ferme);
  padding-left: 0.75rem;
}

.alternatives {
  margin-top: auto;
  padding-top: 0.75rem;
}
.alternatives h4 {
  margin: 0 0 0.35rem;
  color: var(--open);
  font-size: 0.95rem;
}
.alternatives ul, .silos-table ul { margin: 0; padding: 0; list-style: none; }
.alternatives li, .silos-table li {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  margin: 0.35rem 0;
}
.alt-logo {
  flex: none;
  width: 20px;
  height: 20px;
  margin-top: 0.1rem;
  object-fit: contain;
  border-radius: 4px;
  background: #fff;
}
.alt-logo-vide { border: 1px dashed var(--border); background: none; }
.licence {
  font-size: 0.75rem;
  color: var(--muted);
  margin-left: 0.35rem;
}

.maj { font-size: 0.75rem; color: var(--muted); margin-bottom: 0 !important; }

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--card);
}
.silos-table { border-collapse: separate; border-spacing: 0; }
.silos-table th, .silos-table td {
  padding: 0.5rem 0.75rem;
  text-align: left;
  vertical-align: middle;
  border-bottom: 1px solid var(--border);
  background: var(--card);
}
.silos-table thead th {
  font-size: 0.85rem;
  color: var(--muted);
  background: var(--bg);
  white-space: nowrap;
  vertical-align: bottom;
}
.silos-table tbody tr:last-child > * { border-bottom: 0; }
.silos-table tbody tr:hover > * { background: var(--bg); }
.silos-table .nom { font-weight: 600; color: var(--fg); }
.silos-table .operateur { display: block; font-size: 0.8rem; font-weight: 400; color: var(--muted); }

/* Première colonne figée pendant le défilement horizontal */
.silos-table .col-silo,
.silos-table tbody th {
  position: sticky;
  left: 0;
  z-index: 1;
  min-width: 13rem;
  max-width: 17rem;
  border-right: 1px solid var(--border);
}

/* En-têtes de communs : logo et nom à la verticale */
.col-commun { padding: 0.5rem 0.25rem; text-align: center; }
.col-commun-contenu {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
}
.col-commun-nom {
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  max-height: 10rem;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--fg);
  font-weight: 600;
}
.col-commun .alt-logo { margin: 0; }

.croix {
  text-align: center;
  padding: 0.4rem 0.25rem;
  min-width: 2.2rem;
  border-left: 1px solid var(--border);
}
.croix.coche { background: color-mix(in srgb, var(--open) 12%, var(--card)); }
.silos-table tbody tr:hover > .croix.coche { background: color-mix(in srgb, var(--open) 22%, var(--bg)); }
.croix.coche a {
  display: inline-block;
  color: var(--open);
  font-weight: 700;
  font-size: 1.1rem;
  text-decoration: none;
  line-height: 1;
}
.matrice-aide { font-size: 0.85rem; color: var(--muted); margin-top: 0.5rem; }

@media (max-width: 40rem) {
  .silos-table thead th:nth-child(2), .silos-table tbody td:nth-child(2) { display: none; }
  .silos-table .col-silo, .silos-table tbody th { min-width: 9rem; max-width: 11rem; }
  .silos-table .operateur { display: none; }
}

.empty { color: var(--muted); font-style: italic; }

.legend, .about, .investisseurs, .vrais-silos { max-width: 50rem; margin-top: 3rem; }

.investisseurs {
  background: var(--card);
  border: 1px solid var(--border);
  border-left: 4px solid var(--accent);
  border-radius: 10px;
  padding: 1.25rem 1.5rem;
}
.investisseurs h2 { margin-top: 0; }
.investisseurs li { margin: 0.4rem 0; }
.punchline { font-weight: 600; font-style: italic; margin-bottom: 0; }

.actions { display: flex; flex-wrap: wrap; gap: 0.75rem; margin: 1rem 0; }
.bouton {
  display: inline-flex;
  flex-direction: column;
  padding: 0.6rem 1rem;
  border-radius: 6px;
  background: var(--accent);
  color: var(--bg);
  font-weight: 600;
  text-decoration: none;
}
.bouton span { font-weight: 400; font-size: 0.8rem; opacity: 0.85; }
.bouton.secondaire {
  background: transparent;
  color: var(--accent);
  border: 1px solid var(--accent);
  justify-content: center;
}
.bouton:hover { filter: brightness(1.1); }
.source { color: var(--muted); font-size: 0.9rem; }
pre {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.75rem 1rem;
  overflow-x: auto;
  font-size: 0.85rem;
}
pre code { background: none; border: 0; padding: 0; }
.legend dl { display: grid; grid-template-columns: max-content 1fr; gap: 0.5rem 1rem; align-items: baseline; }
.legend dd { margin: 0; }

code {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0.05rem 0.3rem;
}

.sources {
  max-width: 72rem;
  margin: 0 auto 2rem;
  text-align: left;
  font-size: 0.85rem;
}
.sources h2 { font-size: 1.1rem; color: var(--fg); }
.sources h3 { font-size: 0.9rem; margin: 0 0 0.3rem; color: var(--fg); }
.sources h3 a { color: inherit; }
.sources ul { margin: 0 0 1rem; padding-left: 1.1rem; }
.sources li { margin: 0.15rem 0; }
.sources-fiches {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(18rem, 1fr));
  gap: 0.5rem 1.5rem;
}

footer {
  text-align: center;
  color: var(--muted);
  padding: 2rem 1rem;
  border-top: 1px solid var(--border);
}
