:root {
  --bg: #f4f6f4;
  --surface: #ffffff;
  --text: #1b1f1b;
  --muted: #5c665c;
  --border: #dbe2db;
  --accent: #2e7d32;

  /* Dark green used by the patterned bands and the backdrop behind the column. */
  --hero: #14532d;
  --hero-text: #ffffff;
  --hero-muted: #b7e0c2;
  --page: #0e3a1f;

  --channel-pmc: #1565c0;
  --channel-papier-carton: #b8860b;
  --channel-verre: #2e7d32;
  --channel-organique: #6d4c41;
  --channel-residuel: #455a64;
  --channel-recyparc: #6a1b9a;
  --channel-textile: #00838f;
  --channel-collecte-speciale: #c62828;
  --channel-inconnu: #757575;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #141714;
    --surface: #1e221e;
    --text: #eef1ee;
    --muted: #a3aea3;
    --border: #2f352f;
  }
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--text);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", sans-serif;
  min-height: 100vh;
  background-color: var(--page);
  background-image:
    linear-gradient(rgba(9, 38, 20, 0.55), rgba(9, 38, 20, 0.75)),
    url("/background.png");
  background-position: center;
  background-size: cover;
  background-attachment: fixed;
  background-repeat: no-repeat;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.hero {
  padding: 1.75rem 1rem;
  background-color: var(--hero);
  box-shadow: 0 2px 14px rgba(0, 0, 0, 0.3);
}

.hero__inner {
  max-width: 44rem;
  margin-inline: auto;
}

.hero h1 {
  margin: 0;
  color: var(--hero-text);
  font-size: 1.7rem;
  letter-spacing: -0.02em;
}

.header__subtitle {
  margin: 0.2rem 0 0;
  color: var(--hero-muted);
  font-size: 0.9rem;
}

.page {
  max-width: 44rem;
  margin-inline: auto;
  padding: 1.25rem 1rem 3rem;
}

.card {
  background: var(--bg);
  border-radius: 1.25rem;
  padding: 1.25rem 1.25rem 1.5rem;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.3);
}

.banner {
  margin: 0 0 1rem;
  padding: 0.7rem 0.9rem;
  border-radius: 0.6rem;
  background: #fff4e5;
  color: #7a4b00;
  font-size: 0.9rem;
}

.capture {
  display: grid;
  gap: 1rem;
  margin: 1rem 0;
}

.button {
  display: block;
  padding: 1rem;
  border: 0;
  border-radius: 0.75rem;
  background: var(--accent);
  color: #fff;
  font-size: 1.05rem;
  font-weight: 600;
  text-align: center;
  cursor: pointer;
  user-select: none;
}

.button[aria-disabled="true"] {
  background: var(--border);
  color: var(--muted);
  cursor: not-allowed;
}

.preview img {
  display: block;
  width: 100%;
  max-height: 14rem;
  object-fit: cover;
  border-radius: 0.75rem;
}

.preview {
  margin: 0;
}

.status {
  margin: 0.5rem 0;
  min-height: 1.5rem;
  color: var(--muted);
  font-size: 0.92rem;
}

.status[data-tone="error"] {
  color: #c62828;
}

.search input {
  width: 100%;
  padding: 0.8rem 0.9rem;
  border: 1px solid var(--border);
  border-radius: 0.75rem;
  background: var(--surface);
  color: inherit;
  font: inherit;
}

.results {
  display: grid;
  gap: 0.9rem;
  margin-top: 1.2rem;
}

.tile {
  display: grid;
  grid-template-columns: 4.5rem 1fr;
  gap: 0.9rem;
  padding: 0.9rem;
  border: 1px solid var(--border);
  border-radius: 0.9rem;
  background: var(--surface);
}

.tile__thumb {
  width: 4.5rem;
  height: 4.5rem;
  object-fit: cover;
  border-radius: 0.6rem;
  background: var(--bg);
}

.tile__thumb[hidden] {
  display: none;
}

.tile:has(.tile__thumb[hidden]) {
  grid-template-columns: 1fr;
}

.tile__name {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 650;
}

.tile__material {
  margin: 0.15rem 0 0;
  color: var(--muted);
  font-size: 0.85rem;
}

.tile__channels {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin: 0.6rem 0 0;
  padding: 0;
  list-style: none;
}

.chip {
  padding: 0.25rem 0.6rem;
  border-radius: 999px;
  background: var(--channel-inconnu);
  color: #fff;
  font-size: 0.8rem;
  font-weight: 600;
}

.chip[data-channel="pmc"] { background: var(--channel-pmc); }
.chip[data-channel="papier-carton"] { background: var(--channel-papier-carton); }
.chip[data-channel="verre"] { background: var(--channel-verre); }
.chip[data-channel="organique"] { background: var(--channel-organique); }
.chip[data-channel="residuel"] { background: var(--channel-residuel); }
.chip[data-channel="recyparc"] { background: var(--channel-recyparc); }
.chip[data-channel="textile"] { background: var(--channel-textile); }
.chip[data-channel="collecte-speciale"] { background: var(--channel-collecte-speciale); }

.chip__detail {
  font-weight: 400;
  opacity: 0.85;
}

.tile__confidence {
  float: right;
  color: var(--muted);
  font-size: 0.8rem;
  font-variant-numeric: tabular-nums;
}

.tile__description {
  margin: 0.6rem 0 0;
  font-size: 0.9rem;
  color: var(--muted);
  cursor: pointer;
}

.tile__description:not(.is-expanded) {
  display: -webkit-box;
  -webkit-line-clamp: 4;
  line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.empty {
  padding: 1.5rem 0;
  color: var(--muted);
  text-align: center;
}

.footer {
  margin-top: 2.5rem;
  padding-top: 1.2rem;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.45;
}

.footer p {
  margin: 0 0 0.5rem;
}

.footer p:last-child {
  margin-bottom: 0;
}

.footer a {
  color: inherit;
}
