:root {
  --bg: #ffffff;
  --text: #111114;
  --muted: #6e6e76;
  --faint: #a1a1a8;
  --line: #e6e6ea;
  --chip: #f0f0f3;
  --placeholder: #ececf0;
  --bar: rgba(255, 255, 255, 0.82);
  --geo: #5856d6;
  --eco: #1f9bb4;
  --transport: #f28c00;
  --accent: var(--geo);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #000000;
    --text: #f3f3f5;
    --muted: #9a9aa2;
    --faint: #6b6b72;
    --line: #232327;
    --chip: #1c1c1f;
    --placeholder: #1c1c1f;
    --bar: rgba(20, 20, 22, 0.82);
    --geo: #7d7bff;
    --eco: #4cc3da;
    --transport: #ff9f2e;
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --bg: #000000;
  --text: #f3f3f5;
  --muted: #9a9aa2;
  --faint: #6b6b72;
  --line: #232327;
  --chip: #1c1c1f;
  --placeholder: #1c1c1f;
  --bar: rgba(20, 20, 22, 0.82);
  --geo: #7d7bff;
  --eco: #4cc3da;
  --transport: #ff9f2e;
  color-scheme: dark;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 17px/1.35 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}

svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.page {
  max-width: 680px;
  margin: 0 auto;
  padding: calc(env(safe-area-inset-top) + 12px) 16px calc(env(safe-area-inset-bottom) + 96px);
}

/* En-tête */

.header-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 8px 0 12px;
}

h1 {
  margin: 0;
  font-size: 34px;
  line-height: 1.1;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.header-actions { display: flex; gap: 8px; }

.icon-btn {
  position: relative;
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 50%;
  background: var(--chip);
  color: var(--text);
  cursor: pointer;
}

.icon-btn.active { background: var(--accent); color: #fff; }
.icon-btn.spinning svg { animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Le menu déroulant natif couvre l'icône : un toucher ouvre le sélecteur du système. */
.icon-btn select {
  position: absolute;
  inset: 0;
  opacity: 0;
  font-size: 16px;
  cursor: pointer;
}

.search {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 12px;
  height: 40px;
  border-radius: 12px;
  background: var(--chip);
  color: var(--muted);
}

.search svg { width: 18px; height: 18px; flex: none; }

.search input {
  flex: 1;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 16px;
}

.chips {
  display: flex;
  gap: 8px;
  margin: 12px -16px 0;
  padding: 0 16px 4px;
  overflow-x: auto;
  scrollbar-width: none;
}
.chips::-webkit-scrollbar { display: none; }
.chips:empty { display: none; }

.chip {
  flex: none;
  border: 0;
  border-radius: 999px;
  padding: 7px 14px;
  background: var(--chip);
  color: var(--text);
  font: 500 15px/1.2 inherit;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.chip.on { background: var(--accent); color: #fff; }
.chip.source { background: var(--text); color: var(--bg); }

/* Liste */

.day {
  position: sticky;
  top: 0;
  z-index: 1;
  margin: 18px -16px 0;
  padding: 10px 16px 6px;
  background: var(--bar);
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
  font-size: 15px;
  font-weight: 650;
}

.article {
  display: flex;
  gap: 14px;
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
  color: inherit;
  text-decoration: none;
}

.article:active { opacity: 0.6; }
.article .body { flex: 1; min-width: 0; }

.meta {
  display: flex;
  gap: 4px;
  margin-bottom: 5px;
  color: var(--muted);
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.meta b { font-weight: 600; }
.meta.geo b { color: var(--geo); }
.meta.eco b { color: var(--eco); }
.meta.transport b { color: var(--transport); }

.title {
  margin: 0;
  font-size: 17px;
  font-weight: 600;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.thumb {
  flex: none;
  width: 76px;
  height: 76px;
  border-radius: 10px;
  object-fit: cover;
  background: var(--placeholder);
}

.hero { display: block; border-bottom: 0; padding-top: 10px; }
.hero .thumb { width: 100%; height: auto; aspect-ratio: 16 / 9; margin-bottom: 12px; border-radius: 14px; }
.hero .title { font-size: 22px; font-weight: 750; line-height: 1.25; -webkit-line-clamp: 4; }

.summary {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 15px;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.status {
  margin: 80px 0;
  text-align: center;
  color: var(--muted);
}

.footer {
  margin-top: 20px;
  text-align: center;
  color: var(--faint);
  font-size: 12px;
}

/* Barre d'onglets */

.tabbar {
  position: fixed;
  left: 50%;
  bottom: calc(env(safe-area-inset-bottom) + 10px);
  transform: translateX(-50%);
  z-index: 10;
  display: flex;
  gap: 2px;
  width: min(calc(100% - 24px), 520px);
  padding: 5px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--bar);
  -webkit-backdrop-filter: blur(20px) saturate(1.6);
  backdrop-filter: blur(20px) saturate(1.6);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.12);
}

.tabbar a {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 6px 2px 5px;
  border-radius: 999px;
  color: var(--text);
  text-decoration: none;
  font-size: 11px;
  font-weight: 500;
  -webkit-tap-highlight-color: transparent;
}

.tabbar a.on { background: var(--chip); color: var(--accent); }
.tabbar svg { width: 24px; height: 24px; }

@media (min-width: 700px) {
  h1 { font-size: 40px; }
  .page { padding-top: 32px; }
}
