:root {
  --bg: #fafafa;
  --bg-elev: #ffffff;
  --fg: #1a1a1a;
  --muted: #6a6a6a;
  --border: #e2e2e2;
  --accent: #2d5cf6;
  --accent-fg: #ffffff;
  --tag-bg: #f0f0f3;
  --arxiv: #b31b1b;
  --github: #24292e;
  --news: #1668c4;   /* blue — distinct from arxiv red / github black / High green */
  --must: #1a8a4c;   /* High — green */
  --save: #f5a623;   /* Mid — amber */
  --low: #b0b0b0;    /* Low — gray */
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0e0e10;
    --bg-elev: #16161a;
    --fg: #e8e8ec;
    --muted: #9a9aa3;
    --border: #2a2a31;
    --accent: #6b8aff;
    --accent-fg: #0e0e10;
    --tag-bg: #1f1f25;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, "Apple SD Gothic Neo", "Noto Sans KR", Arial, sans-serif;
  background: var(--bg);
  color: var(--fg);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;   /* safety net: never scroll sideways on mobile */
}

.site-header, main, .site-footer {
  max-width: 1100px;
  margin: 0 auto;
  padding: 1.25rem 1.5rem;
}
.site-header { padding-bottom: .5rem; }
.site-banner-link { display: block; margin: 0 0 .5rem; line-height: 0; }
.site-banner { width: 100%; height: auto; display: block; border-radius: 10px; }
/* Banner is 3:1 — on desktop the full-width version becomes tall and dominates
   the viewport, so cap it here while leaving mobile to fill the screen width. */
@media (min-width: 720px) {
  .site-banner-link { max-width: 600px; }
}
.updated { margin: .15rem 0 0; color: var(--muted); font-size: .8rem; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

.page-help {
  margin: 0 0 .9rem;
  background: var(--bg-elev); border: 1px solid var(--border); border-radius: 8px;
  font-size: .88rem; color: var(--muted);
}
.page-help > summary {
  cursor: pointer; padding: .6rem .9rem; font-weight: 600; color: var(--fg);
  list-style: none; user-select: none;
}
.page-help > summary::-webkit-details-marker { display: none; }
.page-help > summary::before { content: "ⓘ "; color: var(--accent); }
.page-help[open] > summary { border-bottom: 1px solid var(--border); }
.page-help-body { padding: .5rem .9rem .8rem; line-height: 1.55; }
.page-help-body p { margin: .35rem 0; }
.page-help-body code { background: var(--tag-bg); padding: .05rem .35rem; border-radius: 4px; color: var(--fg); }
.legend { list-style: none; margin: .4rem 0 0; padding: 0; }
.legend li { margin: .25rem 0; }
.legend .dot { display: inline-block; width: 11px; height: 11px; border-radius: 3px; vertical-align: middle; margin-right: .35rem; }

.filters {
  display: flex; flex-direction: column; gap: .75rem;
  padding: 1rem 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: 1rem;
}
.filter-group { display: flex; align-items: center; flex-wrap: wrap; gap: .35rem; }
.filter-search { width: 100%; padding: 0 0 .35rem; position: relative; max-width: 520px; }
#search-box {
  width: 100%;
  padding: .5rem 2rem .5rem .75rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-elev);
  color: var(--fg);
  font-family: inherit;
  font-size: .92rem;
}
#search-box:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 2px rgba(45,92,246,0.15); }
/* Hide the browser's native search clear button — we have our own #search-clear. */
#search-box::-webkit-search-cancel-button { -webkit-appearance: none; appearance: none; }
#search-clear {
  position: absolute; right: .4rem; top: 50%; transform: translateY(-50%);
  margin-top: -.18rem;
  border: none; background: transparent; color: var(--muted);
  font-size: 1.3rem; line-height: 1; cursor: pointer; padding: 0 .25rem;
}
#search-clear:hover { color: var(--fg); }

.more-filters { width: 100%; }
.more-filters > summary {
  cursor: pointer; font-size: .8rem; color: var(--accent);
  list-style: none; padding: .2rem 0; user-select: none;
}
.more-filters > summary::-webkit-details-marker { display: none; }
.more-filters > summary::before { content: "⚙ "; }
.more-filters-body { display: flex; flex-direction: column; gap: .6rem; padding-top: .4rem; }

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

#back-to-top {
  position: fixed; right: 1.2rem; bottom: 1.2rem; z-index: 50;
  padding: .5rem .8rem; border: 1px solid var(--border);
  background: var(--bg-elev); color: var(--fg); border-radius: 999px;
  font-size: .82rem; font-family: inherit; cursor: pointer;
  box-shadow: 0 2px 8px rgba(0,0,0,0.18);
}
#back-to-top:hover { border-color: var(--accent); color: var(--accent); }

mark { background: #ffe27a; color: #000; border-radius: 2px; padding: 0 .1em; }
@media (prefers-color-scheme: dark) { mark { background: #b8860b; color: #fff; } }
.filter-group strong {
  font-size: .72rem; color: var(--muted);
  text-transform: uppercase; letter-spacing: .06em;
  margin-right: .55rem; min-width: 60px;
}
.chip {
  border: 1px solid var(--border);
  background: var(--bg-elev);
  color: var(--fg);
  border-radius: 999px;
  padding: .25rem .7rem;
  font-size: .82rem;
  cursor: pointer;
  font-family: inherit;
  transition: border-color .12s, background .12s, color .12s;
}
.chip[hidden], .filter-group[hidden] { display: none; }
.chip:hover { border-color: var(--accent); }
.chip.active { background: var(--accent); color: var(--accent-fg); border-color: var(--accent); }
.chip .count { opacity: .65; font-size: .76rem; margin-left: .15rem; }

.archive-nav {
  display: flex; gap: .7rem; flex-wrap: wrap; align-items: center;
  font-size: .85rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 1rem;
  color: var(--muted);
}
.archive-nav a { color: var(--accent); text-decoration: none; }
.archive-nav a:hover { text-decoration: underline; }
.archive-nav strong { color: var(--muted); text-transform: uppercase; font-size: .72rem; letter-spacing: .06em; font-weight: 600; }

.result-count { color: var(--muted); font-size: .82rem; margin: 0 0 .8rem; }

.section { margin: 1.5rem 0; }
.section-title {
  font-size: 1.15rem; margin: 0 0 .2rem;
  display: flex; align-items: baseline; gap: .5rem;
}
.section-hint { margin: 0 0 .8rem; font-size: .85rem; }
.section-deprioritized { opacity: .82; }
.section-deprioritized .item { background: transparent; }
.section-deprioritized .section-title::before { content: "↓ "; color: var(--muted); }

.items { display: flex; flex-direction: column; gap: .85rem; }
.item {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-left: 4px solid var(--low);  /* color-bar — overridden per priority below */
  border-radius: 10px;
  padding: 1rem 1.15rem;
  transition: border-color .12s, transform .12s;
  display: flex; gap: 1rem; align-items: flex-start;
  /* Let the browser skip layout/paint for off-screen cards — keeps a long
     feed cheap to render. contain-intrinsic-size reserves space so the
     scrollbar doesn't jump. */
  content-visibility: auto;
  contain-intrinsic-size: auto 180px;
}
.item-body { flex: 1 1 auto; min-width: 0; }
.item-thumb {
  flex: 0 0 280px;
  width: 280px; height: 175px;     /* 16:10 — larger, real focal point of each card */
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg);
}
.item-thumb-placeholder {
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; text-transform: uppercase;
  font-size: 1.3rem; letter-spacing: .08em; color: white;
  border: none;
}
.item-thumb-arxiv { background: var(--arxiv); }
.item-thumb-news { background: var(--news); }
.item-thumb-github { background: var(--github); }
@media (max-width: 800px) {
  .item-thumb { flex-basis: 200px; width: 200px; height: 125px; }
}
@media (max-width: 600px) {
  /* Stack the thumb on top on phones — full width hero */
  .item { flex-direction: column; }
  .item-thumb { flex-basis: auto; width: 100%; height: 200px; }
}
.item[data-priority="must_read"] { border-left-color: var(--must); }
.item[data-priority="save_for_later"] { border-left-color: var(--save); }
.item[data-priority="low_priority"] { border-left-color: var(--low); }
.item:hover { border-color: var(--accent); border-left-color: var(--accent); }
.item-header {
  display: flex; align-items: baseline; flex-wrap: wrap; gap: .55rem;
  margin-bottom: .35rem;
}
.item-title {
  font-size: 1.04rem; font-weight: 600;
  color: var(--fg); text-decoration: none;
  flex: 1 1 auto; min-width: 0;
  overflow-wrap: anywhere; word-break: break-word;  /* break long repo names / hyphen chains */
}
.item-title:hover { color: var(--accent); }
.item-meta { font-size: .8rem; color: var(--muted); margin-bottom: .35rem; overflow-wrap: anywhere; }
.item-summary {
  margin: .45rem 0 0;
  color: var(--fg);
  font-size: .94rem;
  overflow-wrap: anywhere; word-break: break-word;  /* break long URLs / tokens */
  /* Summaries are LLM-compressed to ~2-3 sentences so we show them in full —
     the card IS the destination. Click the title for the original source. */
}

.badge {
  font-size: .66rem;
  padding: .15rem .5rem;
  border-radius: 4px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: white;
  flex: 0 0 auto;
}
.badge-arxiv { background: var(--arxiv); }
.badge-github { background: var(--github); }
.badge-news { background: var(--news); }
.badge-new { background: #d97706; color: #fff; }   /* freshness highlight */
.badge-must_read { background: var(--must); }
.badge-save_for_later { background: var(--save); }
.badge-low_priority { background: var(--low); }
.badge-survey { background: #7c3aed; color: #fff; }   /* awesome-list / paper-list / notes */

.item-tags { display: flex; flex-wrap: wrap; gap: .3rem; margin: .35rem 0 0; }
.tag {
  font-size: .73rem;
  background: var(--tag-bg);
  color: var(--muted);
  padding: .12rem .55rem;
  border-radius: 4px;
}

.site-footer {
  color: var(--muted);
  font-size: .82rem;
  border-top: 1px solid var(--border);
  margin-top: 2rem;
  padding-top: 1.25rem;
  padding-bottom: 2rem;
}
.site-footer a { color: var(--accent); text-decoration: none; }
.site-footer a:hover { text-decoration: underline; }
.muted { color: var(--muted); }
code { font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, monospace; font-size: .88em; }

@media (max-width: 600px) {
  .site-header, main, .site-footer { padding: 1rem 1rem; }
  .filter-group strong { min-width: auto; margin-right: .3rem; }
  .item { padding: .85rem .95rem; }
  .item-title { font-size: 1rem; }
}
