:root {
  --bg: #f6f7f9;
  --panel: #ffffff;
  --ink: #15181e;
  --ink-2: #4a5160;
  --ink-3: #7c8494;
  --line: #e3e6eb;
  --accent: #2f6fed;
  --accent-soft: #e8efff;
  --new: #e5484d;
  --c-systeme: #e5484d;
  --c-reseau: #2f6fed;
  --c-presse: #8e4ec6;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1115;
    --panel: #171a21;
    --ink: #e8eaee;
    --ink-2: #b2b8c3;
    --ink-3: #7d8594;
    --line: #262b35;
    --accent: #6b9bff;
    --accent-soft: #1b2640;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: calc(var(--top-h, 118px) + 52px); }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.55 ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
a { color: inherit; }
button { font: inherit; color: inherit; }
.muted { color: var(--ink-3); }
.wrap { max-width: 1200px; margin: 0 auto; padding: 0 24px; }

/* ---------- Header ---------- */
.top {
  position: sticky; top: 0; z-index: 10;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--line);
}
.top-inner { display: flex; align-items: center; gap: 24px; padding-top: 16px; padding-bottom: 12px; }
.brand { flex: 1; min-width: 0; }
h1 { font-size: 18px; margin: 0; letter-spacing: -.01em; }
.brand p { margin: 0; font-size: 13px; }
.search { position: relative; width: min(360px, 42vw); }
.search svg { position: absolute; left: 11px; top: 50%; width: 16px; height: 16px; transform: translateY(-50%); fill: none; stroke: var(--ink-3); stroke-width: 2; stroke-linecap: round; }
.search input {
  width: 100%; padding: 9px 12px 9px 34px; border-radius: 10px;
  border: 1px solid var(--line); background: var(--panel); color: var(--ink); font: inherit; outline: none;
}
.search input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }

.tabs { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab {
  border: 0; background: none; cursor: pointer; white-space: nowrap;
  padding: 10px 12px; font-size: 14px; color: var(--ink-2);
  border-bottom: 2px solid transparent; display: inline-flex; align-items: center; gap: 7px;
}
.tab:hover { color: var(--ink); }
.tab[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--accent); font-weight: 600; }
.dot { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.tab .n { font-size: 12px; color: var(--ink-3); font-weight: 400; font-variant-numeric: tabular-nums; }

/* ---------- Layout ---------- */
.layout { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 56px; padding-top: 32px; padding-bottom: 48px; align-items: start; }
.side { position: sticky; top: calc(var(--top-h, 118px) + 16px); max-height: calc(100vh - var(--top-h, 118px) - 32px); overflow: auto; padding-right: 4px; }
.side section { margin-bottom: 30px; }
.side h2 { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-3); margin: 0 0 10px; font-weight: 600; }
.hint { font-size: 12px; color: var(--ink-3); margin: 6px 0 0; }

.seg { display: grid; grid-template-columns: repeat(3, 1fr); background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 3px; }
.seg button { border: 0; background: none; padding: 6px 0; border-radius: 7px; cursor: pointer; font-size: 13px; color: var(--ink-2); }
.seg button[aria-pressed="true"] { background: var(--accent-soft); color: var(--accent); font-weight: 600; }

.switch { display: flex; align-items: center; gap: 10px; cursor: pointer; font-size: 14px; }
.switch input { position: absolute; opacity: 0; }
.track { width: 34px; height: 20px; border-radius: 20px; background: var(--line); position: relative; transition: background .15s; flex: none; }
.track::after { content: ""; position: absolute; left: 2px; top: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform .15s; box-shadow: 0 1px 2px rgba(0,0,0,.2); }
.switch input:checked + .track { background: var(--accent); }
.switch input:checked + .track::after { transform: translateX(14px); }
.switch input:focus-visible + .track { outline: 2px solid var(--accent); outline-offset: 2px; }

.side details > summary {
  list-style: none; cursor: pointer; font-size: 12px; text-transform: uppercase; letter-spacing: .06em;
  color: var(--ink-3); font-weight: 600; margin: 0 0 10px; display: flex; align-items: center; gap: 6px;
}
.side details > summary::-webkit-details-marker { display: none; }
.side details > summary::after { content: "▸"; font-size: 10px; transition: transform .15s; }
.side details[open] > summary::after { transform: rotate(90deg); }
.side details > summary .sel { text-transform: none; letter-spacing: 0; color: var(--accent); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  border: 1px solid var(--line); background: var(--panel); border-radius: 999px;
  padding: 3px 10px; font-size: 12.5px; cursor: pointer; color: var(--ink-2);
}
.chip:hover { border-color: var(--ink-3); }
.chip[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: #fff; }
.chip .n { opacity: .65; margin-left: 3px; font-variant-numeric: tabular-nums; }
.chip:disabled { opacity: .4; cursor: default; }

.sources { list-style: none; margin: 0; padding: 0; font-size: 13px; }
.sources li { display: flex; align-items: center; gap: 8px; padding: 4px 6px; border-radius: 6px; cursor: pointer; color: var(--ink-2); }
.sources li:hover { background: var(--panel); }
.sources li[aria-pressed="true"] { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.sources img { width: 14px; height: 14px; border-radius: 3px; flex: none; }
.sources .nm { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sources .st { font-size: 11px; font-variant-numeric: tabular-nums; color: var(--ink-3); }
.sources .err { color: var(--new); }
.sources .grp-head {
  cursor: default; font-size: 11px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase;
  color: var(--ink-3); padding: 12px 6px 4px; gap: 7px;
}
.sources .grp-head:first-child { padding-top: 0; }
.sources .grp-head:hover { background: none; }
.sources .grp-head .dot { width: 7px; height: 7px; }

/* ---------- Feed ---------- */
.feed { min-width: 0; max-width: 760px; }
.feed-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; margin-bottom: 4px; }
.feed-head p { margin: 0; font-size: 13px; }
.feed-head .actions { display: flex; gap: 16px; }
.new-count { color: var(--new); font-weight: 600; margin-left: 6px; }
.new-count:empty { display: none; }
.link { border: 0; background: none; color: var(--accent); cursor: pointer; font-size: 13px; padding: 0; }
.link:hover { text-decoration: underline; }

/* Titre de jour, collé sous l'en-tête pendant le défilement */
section:first-of-type > .day { padding-top: 12px; }
.day {
  position: sticky; top: var(--top-h, 118px); z-index: 2;
  font-size: 13px; font-weight: 600; color: var(--ink-2);
  margin: 0; padding: 36px 4px 12px; background: var(--bg);
}

/* Liste façon magazine : vignette à gauche, texte à droite, sans encadré */
.list { display: grid; gap: 32px; padding-top: 6px; }
.item {
  display: grid; grid-template-columns: 164px minmax(0, 1fr); gap: 0 22px; align-items: start;
}

.thumb {
  display: block; aspect-ratio: 16 / 10; border-radius: 10px; overflow: hidden; text-decoration: none;
  background: var(--line); box-shadow: 0 0 0 1px color-mix(in srgb, var(--ink) 6%, transparent);
}
.thumb > img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .25s; }
.item:hover .thumb > img { transform: scale(1.03); }
/* Pas d'image : tuile aux couleurs de la catégorie avec le logo de la source */
.thumb .ph {
  width: 100%; height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px;
  background:
    radial-gradient(120% 120% at 0% 0%, color-mix(in srgb, var(--cat) 38%, transparent), transparent 60%),
    linear-gradient(135deg, color-mix(in srgb, var(--cat) 22%, var(--panel)), color-mix(in srgb, var(--cat) 8%, var(--panel)));
  color: var(--ink-2); font-size: 12px; font-weight: 600; text-align: center; padding: 8px;
}
.thumb .ph img { width: 34px; height: 34px; border-radius: 7px; background: #fff; padding: 3px; box-shadow: 0 1px 3px rgba(0,0,0,.15); }

.item h3 { font-size: 18px; line-height: 1.4; margin: 0; font-weight: 650; letter-spacing: -.012em; max-width: 27em; text-wrap: pretty; }
.item h3 a { text-decoration: none; }
.item h3 a:hover { text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px; }

.meta { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; margin-top: 7px; font-size: 13px; color: var(--ink-3); }
.meta .grp { color: var(--ink-2); font-weight: 600; }
.meta .cat { width: 6px; height: 6px; border-radius: 50%; background: var(--cat); }
.meta .sep::before { content: "·"; }
.meta .new {
  color: var(--new); background: color-mix(in srgb, var(--new) 13%, transparent); font-weight: 700; font-size: 10px; letter-spacing: .05em;
  text-transform: uppercase; padding: 1px 6px; border-radius: 4px;
}

.item .sum {
  margin: 8px 0 0; color: var(--ink-3); font-size: 14.5px; line-height: 1.6; max-width: 36em;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.tags { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 8px; }
.tag { border: 0; background: none; padding: 0; font: inherit; font-size: 12.5px; color: var(--accent); cursor: pointer; }
.tag::before { content: "#"; opacity: .6; }
.tag:hover { text-decoration: underline; }

/* Article lu : estompé, toujours cliquable */
.item.read .body, .item.read .thumb { opacity: .5; transition: opacity .15s; }
.item.read:hover .body, .item.read:hover .thumb { opacity: .85; }
.item.read h3 { font-weight: 500; }

.more { text-align: center; margin: 28px 0 0; }
.empty { text-align: center; padding: 60px 0; color: var(--ink-3); }
.foot { display: flex; gap: 8px; flex-wrap: wrap; font-size: 12px; padding-top: 12px; padding-bottom: 32px; border-top: 1px solid var(--line); }

/* ---------- Responsive ---------- */
@media (max-width: 860px) {
  .wrap { padding: 0 14px; }
  .layout { grid-template-columns: 1fr; gap: 8px; padding-top: 14px; }
  .side { position: static; max-height: none; overflow: visible; display: grid; gap: 14px; }
  .side section { margin: 0; }
  .side section:last-child { display: none; }
  .top-inner { flex-wrap: wrap; gap: 10px; }
  .search { width: 100%; }
  .brand p { display: none; }
  .item { grid-template-columns: 96px minmax(0, 1fr); gap: 0 14px; }
  .list { gap: 26px; }
  .item h3 { font-size: 16px; }
  .item .sum { -webkit-line-clamp: 2; font-size: 14px; }
  .thumb .ph span { display: none; }
  .day { padding: 28px 2px 10px; }
}
