:root {
  --bg: #ffffff;
  --ink: #1c1c1a;
  --ink-2: #3d3d39;
  --muted: #5f5f59;
  --line: #e7e5df;
  --line-soft: #f0efea;
  --wash: #f6f5f1;
  --accent: #4338ca;
  --accent-ink: #3730a3;
  --accent-wash: #eef2ff;
  --serif: 'Newsreader', Georgia, 'Times New Roman', serif;
  --sans: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  color-scheme: light;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font-family: var(--sans); font-size: 16px; line-height: 1.5;
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
a { color: inherit; }
button, input { font: inherit; color: inherit; }
img { display: block; max-width: 100%; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }

.wrap { max-width: 1120px; margin: 0 auto; padding: 0 24px; }
@media (max-width: 600px) { .wrap { padding: 0 16px; } }

.skip { position: absolute; left: -9999px; top: 8px; }
.skip:focus { left: 16px; z-index: 50; background: var(--ink); color: #fff; padding: 8px 12px; border-radius: 8px; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.boot { color: var(--muted); padding: 64px 0; }

/* ---------- header ---------- */
.site { border-bottom: 1px solid var(--line); background: var(--bg); }
.site-row { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 24px; min-height: 64px; }
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; line-height: 1.1; padding: 8px 0; }
.brand-logo { width: 40px; height: 40px; flex: none; }
.brand-text { display: flex; flex-direction: column; }
.brand-name { font-family: var(--serif); font-size: 24px; font-weight: 600; letter-spacing: 0.06em; }
.brand-by { font-size: 11px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); margin-top: 3px; }
.site-nav { display: flex; gap: 4px; margin-left: auto; }
.site-nav a {
  text-decoration: none; font-size: 15px; font-weight: 500; color: var(--muted);
  padding: 10px 14px; border-radius: 999px; min-height: 44px; display: inline-flex; align-items: center;
}
.site-nav a:hover { color: var(--ink); background: var(--wash); }
.site-nav a[aria-current="page"] { color: var(--ink); font-weight: 600; background: var(--wash); }
body[data-view="start"] .site-nav { display: none; }

/* ---------- type ---------- */
.display {
  font-family: var(--serif); font-weight: 400; font-size: clamp(34px, 5vw, 46px);
  line-height: 1.08; letter-spacing: -0.02em; margin: 0 0 8px;
}
.lede { margin: 0 0 28px; font-size: 17px; color: var(--muted); }
.eyebrow { margin: 0 0 10px; font-size: 13px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--accent); }
.h2 { font-family: var(--serif); font-weight: 600; font-size: 24px; margin: 0 0 4px; letter-spacing: -0.01em; }
.sub { margin: 0 0 16px; font-size: 15px; color: var(--muted); }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 10px 18px; border-radius: 999px; cursor: pointer;
  border: 1.5px solid var(--ink); background: var(--bg); color: var(--ink);
  font-size: 15px; font-weight: 600; text-decoration: none; white-space: nowrap;
}
.btn:hover { background: var(--wash); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-ink); border-color: var(--accent-ink); }
.btn-primary:disabled { background: #c7c9e8; border-color: #c7c9e8; cursor: not-allowed; }
.btn-small { min-height: 40px; padding: 6px 14px; font-size: 14px; }
.btn-follow { border-color: var(--accent); color: var(--accent); }
.btn-follow[aria-pressed="true"] { background: var(--accent); color: #fff; }
.btn-quiet { border-color: var(--line); color: var(--muted); }
.btn-danger { border-color: #b91c1c; color: #b91c1c; }
.btn-danger:hover { background: #fef2f2; }
.linkish { background: none; border: 0; padding: 0; cursor: pointer; color: var(--accent); font-weight: 600; text-decoration: underline; text-underline-offset: 3px; }

/* ---------- search ---------- */
.search-label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 8px; }
.search {
  display: flex; align-items: center; gap: 12px; height: 56px; max-width: 720px;
  padding: 0 16px; border: 1.5px solid var(--ink); border-radius: 12px; background: var(--bg);
}
.search:focus-within { box-shadow: 0 0 0 3px var(--accent-wash); border-color: var(--accent); }
.search svg { flex: none; }
.search input { flex: 1; min-width: 0; border: 0; outline: none; background: transparent; font-size: 17px; }
.search input::placeholder { color: #75756e; }
.search input::-webkit-search-cancel-button { cursor: pointer; }
.search kbd { font-family: var(--sans); font-size: 12px; color: var(--muted); border: 1px solid #d6d3cc; border-radius: 6px; padding: 2px 7px; }
@media (max-width: 600px) { .search kbd { display: none; } .search { height: 52px; } }

/* ---------- chips ---------- */
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 20px 0 32px; }
.chip {
  min-height: 40px; padding: 8px 16px; border-radius: 999px; cursor: pointer;
  border: 1px solid #d6d3cc; background: var(--bg); font-size: 14px; font-weight: 500;
}
.chip:hover { border-color: var(--ink); }
.chip[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: #fff; }

/* ---------- picker (start + settings) ---------- */
.start { padding: 48px 0 96px; max-width: 980px; }
.picker-section { margin-top: 36px; }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.tile {
  text-align: left; cursor: pointer; display: flex; flex-direction: column; gap: 4px;
  padding: 16px 18px; min-height: 112px; border-radius: 14px;
  border: 1.5px solid var(--line); background: var(--bg);
}
.tile:hover { border-color: #b9b6ad; }
.tile[aria-pressed="true"] { border: 2px solid var(--accent); background: var(--accent-wash); padding: 15.5px 17.5px; }
.tile-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.tile-label { font-size: 17px; font-weight: 600; }
.tile-desc { font-size: 14px; color: var(--muted); line-height: 1.4; }
.tile-count { margin-top: auto; padding-top: 6px; font-size: 13px; color: var(--muted); font-weight: 500; }
.tick {
  flex: none; width: 22px; height: 22px; border-radius: 999px; border: 1.5px solid #c9c6bd;
  display: flex; align-items: center; justify-content: center; color: transparent;
}
.tile[aria-pressed="true"] .tick { background: var(--accent); border-color: var(--accent); color: #fff; }

.products { border: 1px solid var(--line); border-radius: 18px; padding: 24px; }
.products .search { max-width: none; height: 52px; }
.list-label { margin: 18px 0 6px; font-size: 13px; font-weight: 600; color: var(--muted); }
.presults { list-style: none; margin: 0; padding: 0; }
.presult { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line-soft); }
.presult:first-child { border-top: 0; }
.pname { flex: 1; min-width: 0; font-weight: 600; font-size: 15px; }
.pkind { font-weight: 400; color: var(--muted); }
.presult.empty { color: var(--muted); font-size: 15px; }
.following { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 18px; }
.following-label { font-size: 14px; font-weight: 600; color: var(--muted); margin-right: 4px; }
.fchip {
  display: inline-flex; align-items: center; gap: 4px; padding: 4px 4px 4px 12px; border-radius: 999px;
  background: var(--accent-wash); color: var(--accent-ink); font-size: 14px; font-weight: 600;
}
.fchip button {
  width: 32px; height: 32px; border-radius: 999px; border: 0; background: transparent; cursor: pointer;
  color: var(--accent-ink); display: inline-flex; align-items: center; justify-content: center;
}
.fchip button:hover { background: #dfe4ff; }

.actions {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px;
  margin-top: 36px; padding-top: 24px; border-top: 1px solid var(--line);
}
.actions-summary { font-size: 15px; color: var(--muted); font-weight: 500; }
.actions-right { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.saved-note { font-size: 14px; color: #166534; font-weight: 600; }
.danger { margin-top: 48px; padding: 20px 24px; border: 1px solid var(--line); border-radius: 14px; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; }
.danger p { margin: 0; color: var(--muted); font-size: 15px; max-width: 560px; }

/* ---------- feed ---------- */
.feed { padding: 40px 0 96px; }
.feed-grid { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 48px; align-items: start; }
@media (max-width: 960px) {
  .feed-grid { grid-template-columns: minmax(0, 1fr); gap: 24px; }
  .side { order: -1; }
}
.results-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 12px; margin: 20px 0 8px; }
.results-head h2 { margin: 0; font-family: var(--serif); font-weight: 600; font-size: 22px; }
.feed-matches { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 4px 0 20px; }
.feed-matches .fm { display: inline-flex; align-items: center; gap: 10px; padding: 4px 4px 4px 14px; border: 1px solid var(--line); border-radius: 999px; font-size: 14px; font-weight: 600; }

/* top story */
.top { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: 28px; padding-bottom: 28px; margin-bottom: 4px; border-bottom: 1px solid var(--line); }
.top-img { display: block; border-radius: 12px; overflow: hidden; aspect-ratio: 16 / 10; }
.top .title { font-size: clamp(26px, 3vw, 32px); line-height: 1.18; }
.top .summary { -webkit-line-clamp: 4; font-size: 16px; }
.top.no-img { grid-template-columns: minmax(0, 1fr); }
@media (max-width: 700px) { .top { grid-template-columns: minmax(0, 1fr); gap: 16px; } }

/* rows */
.stream { display: flex; flex-direction: column; }
.item { display: flex; gap: 24px; padding: 22px 0; border-bottom: 1px solid var(--line-soft); }
.item-body { flex: 1; min-width: 0; }
.meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.tag { font-size: 12px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--c, var(--muted)); }
.src { font-weight: 600; color: var(--ink-2); }
.new { font-size: 11px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: #fff; background: var(--accent); border-radius: 4px; padding: 1px 6px; }
.title {
  display: block; font-family: var(--serif); font-size: 22px; line-height: 1.28; font-weight: 500;
  letter-spacing: -0.005em; text-decoration: none; color: var(--ink);
}
.title:hover { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 4px; }
.title:visited { color: #5b5b55; }
.summary {
  margin: 8px 0 0; font-size: 15px; line-height: 1.55; color: var(--ink-2);
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden;
}
.bullets { margin: 10px 0 0; padding: 0; list-style: none; font-size: 15px; color: var(--ink-2); }
.bullets li { position: relative; padding-left: 18px; margin: 4px 0; line-height: 1.45; }
.bullets li::before { content: ''; position: absolute; left: 4px; top: 0.62em; width: 5px; height: 5px; border-radius: 99px; background: var(--accent); }
.more { display: inline-block; margin-top: 10px; font-size: 14px; font-weight: 600; color: var(--accent); text-decoration: none; }
.more:hover { text-decoration: underline; }
.also { margin: 10px 0 0; font-size: 13px; color: var(--muted); }
.also a { color: var(--ink-2); font-weight: 600; text-decoration: none; }
.also a:hover { text-decoration: underline; }
.thumb { flex: none; width: 136px; height: 92px; border-radius: 10px; overflow: hidden; margin-top: 4px; }
.thumb img, .top-img img { width: 100%; height: 100%; object-fit: cover; opacity: 0; transition: opacity .25s ease; }
.thumb.ready img, .top-img.ready img { opacity: 1; }
@media (max-width: 600px) {
  .item { gap: 14px; padding: 18px 0; }
  .thumb { width: 88px; height: 66px; }
  .title { font-size: 19px; }
}
.item.is-fresh, .top.is-fresh { animation: fresh 2.4s ease-out; }
@keyframes fresh { from { background: var(--accent-wash); } to { background: transparent; } }
@media (prefers-reduced-motion: reduce) { .item.is-fresh, .top.is-fresh { animation: none; } }

.status { padding: 40px 0; color: var(--muted); font-size: 16px; }
.status strong { color: var(--ink); display: block; font-family: var(--serif); font-size: 22px; font-weight: 500; margin-bottom: 4px; }
.loadmore { margin: 28px auto 0; display: flex; }
.loading-line { height: 2px; background: linear-gradient(90deg, transparent, var(--accent), transparent); background-size: 50% 100%; background-repeat: no-repeat; animation: slide 1s linear infinite; margin-bottom: -2px; }
@keyframes slide { from { background-position: -50% 0; } to { background-position: 150% 0; } }

/* new-stories pill */
.newpill {
  position: fixed; top: 16px; left: 50%; transform: translateX(-50%); z-index: 20;
  min-height: 44px; padding: 10px 20px; border-radius: 999px; border: 0; cursor: pointer;
  background: var(--accent); color: #fff; font-weight: 600; font-size: 15px;
  box-shadow: 0 6px 20px rgba(30, 27, 75, 0.25);
}

/* sidebar */
.side-box { border: 1px solid var(--line); border-radius: 16px; padding: 20px; }
.side-box .h2 { font-size: 20px; }
.side-box .sub { font-size: 14px; margin-bottom: 8px; }
.side-list { list-style: none; margin: 0; padding: 0; }
.side-list li { border-top: 1px solid var(--line-soft); }
.side-list a { display: block; padding: 12px 0; text-decoration: none; }
.side-list a:hover .side-title { text-decoration: underline; }
.side-name { display: block; font-size: 14px; font-weight: 700; }
.side-title { display: block; font-size: 14px; color: var(--ink-2); line-height: 1.4; margin-top: 2px; }
.side-time { display: block; font-size: 12px; color: var(--muted); margin-top: 2px; }
.side-foot { margin-top: 12px; font-size: 14px; }
.side-foot a { color: var(--accent); font-weight: 600; text-decoration: none; }
.side-foot a:hover { text-decoration: underline; }
.live { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); }
.live::before { content: ''; width: 8px; height: 8px; border-radius: 99px; background: #16a34a; }
.live.off::before { background: #a8a29e; }

/* ---------- about & legal ---------- */
.about { padding: 48px 0 96px; max-width: 760px; }
.about .thanks { font-family: var(--serif); font-size: 22px; line-height: 1.55; color: var(--ink); margin: 0 0 8px; }
.about h2 { font-family: var(--serif); font-weight: 600; font-size: 26px; margin: 44px 0 10px; letter-spacing: -0.01em; }
.about p, .about li { font-size: 17px; line-height: 1.65; color: var(--ink-2); }
.about ul { padding-left: 22px; margin: 8px 0; }
.about li { margin: 6px 0; }
.about .note { margin-top: 44px; padding: 18px 22px; border: 1px solid var(--line); border-radius: 14px; font-size: 15px; color: var(--muted); background: var(--wash); }
.about-logo { width: 72px; height: 72px; margin-bottom: 20px; }
.site-foot { border-top: 1px solid var(--line); margin-top: 24px; }
.site-foot .wrap { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 24px; padding-top: 20px; padding-bottom: 28px; font-size: 14px; color: var(--muted); }
.site-foot a { color: var(--muted); }
.site-foot a:hover { color: var(--ink); }
@media (max-width: 600px) { .site-nav a { padding: 8px 10px; font-size: 14px; } }
