/* Feed Digest — a calm "morning briefing" reader.
 * Editorial feel via Newsreader headlines + Inter UI, generous whitespace, an
 * ink-teal accent and hairline section rules — the newspaper cue without the
 * dense-broadsheet cliché. The digest column is the front page; controls sit
 * quietly in a side rail.
 */

:root {
  --paper: #f6f7f6;
  --card: #ffffff;
  --ink: #14181c;
  --ink-2: #4c545c;
  --ink-3: #8a929a;
  --line: #e4e7e4;
  --line-2: #eef0ee;
  --accent: #1f6b7a;         /* ink teal */
  --accent-ink: #17505c;
  --flag: #b23a2e;           /* editorial red, used sparingly */
  --shadow: 0 1px 2px rgba(20,24,28,.05), 0 16px 34px -20px rgba(20,24,28,.30);
}
@media (prefers-color-scheme: dark) {
  :root {
    --paper: #0e1113;
    --card: #171b1e;
    --ink: #eceeec;
    --ink-2: #a6adb2;
    --ink-3: #6d757b;
    --line: #262b2e;
    --line-2: #1d2124;
    --accent: #46a5b7;
    --accent-ink: #6cc0d0;
    --flag: #e0655a;
    --shadow: 0 1px 2px rgba(0,0,0,.4), 0 16px 34px -20px rgba(0,0,0,.7);
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  margin: 0 auto;
  max-width: 1120px;
  padding: 2.6rem 1.1rem 5rem;
  font-family: "Inter", system-ui, sans-serif;
  background: var(--paper);
  color: var(--ink);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

/* ---------- masthead ---------- */
.masthead { border-bottom: 2px solid var(--ink); padding-bottom: 1.3rem; margin-bottom: 1.8rem; }
.dateline {
  font-size: .74rem; text-transform: uppercase; letter-spacing: .18em;
  color: var(--flag); font-weight: 600; margin-bottom: .5rem;
}
.masthead h1 {
  font-family: "Newsreader", Georgia, serif;
  font-weight: 600; font-size: clamp(2.4rem, 7vw, 4rem);
  line-height: 1; letter-spacing: -.01em; margin: 0 0 .6rem;
}
.lede {
  font-family: "Newsreader", Georgia, serif; font-size: 1.15rem;
  color: var(--ink-2); max-width: 42rem; margin: 0 0 .5rem;
}
.fineprint { font-size: .82rem; color: var(--ink-3); margin: 0; }
.fineprint a { color: var(--accent-ink); }

/* ---------- layout ---------- */
.layout { display: grid; grid-template-columns: 350px 1fr; gap: 1.6rem; align-items: start; }
@media (max-width: 820px) { .layout { grid-template-columns: 1fr; } }

.card {
  background: var(--card); border-radius: 14px; box-shadow: var(--shadow);
  padding: 1.2rem 1.3rem 1.35rem; margin-bottom: 1.2rem;
}
.card h2, .digest-head h2 {
  font-family: "Newsreader", Georgia, serif; font-weight: 600; font-size: 1.3rem;
  margin: 0 0 .9rem;
}
.rail { position: sticky; top: 1rem; }
@media (max-width: 820px) { .rail { position: static; } }

/* ---------- forms ---------- */
input, select, button, textarea {
  font: inherit; font-size: .92rem; color: var(--ink);
  background: var(--card); border: 1px solid var(--line); border-radius: 9px; padding: .5rem .65rem;
}
input:focus-visible, select:focus-visible, button:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 1px;
}
button { cursor: pointer; }
button.primary { background: var(--accent); color: #fff; border-color: var(--accent); font-weight: 600; }
button.ghost { background: transparent; }
.add-row { display: flex; gap: .5rem; }
.add-row input { flex: 1; min-width: 0; }
.field { display: flex; flex-direction: column; gap: .3rem; margin-bottom: .85rem; font-size: .82rem; color: var(--ink-2); }
.field em { color: var(--ink-3); font-style: normal; }
.field-row { display: flex; gap: 1rem; align-items: flex-end; flex-wrap: wrap; margin-bottom: .9rem; }
.field-row .field { margin-bottom: 0; }
.toggle { display: flex; align-items: center; gap: .45rem; font-size: .88rem; cursor: pointer; }
.toggle input { width: 16px; height: 16px; accent-color: var(--accent); }
.settings-actions { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; }
#feed-msg, #settings-msg { font-size: .82rem; margin: .5rem 0 0; }
.msg-err { color: var(--flag); }
.msg-ok { color: var(--accent-ink); }

/* ---------- samples + feed list ---------- */
.samples { margin: 1rem 0 .5rem; }
.samples-label { font-size: .8rem; color: var(--ink-3); }
.chips { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: .5rem; }
.chip {
  font-size: .8rem; padding: .28rem .6rem; border-radius: 999px;
  border: 1px solid var(--line); background: var(--line-2); color: var(--ink-2); cursor: pointer;
}
.chip:hover { border-color: var(--accent); color: var(--accent-ink); }
.feed-list { list-style: none; margin: 1rem 0 0; padding: 0; }
.feed-list li {
  display: flex; align-items: center; gap: .5rem; justify-content: space-between;
  padding: .5rem 0; border-bottom: 1px solid var(--line-2); font-size: .9rem;
}
.feed-list li:last-child { border-bottom: none; }
.feed-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.feed-del { border: none; background: none; color: var(--ink-3); font-size: .95rem; padding: .1rem .3rem; cursor: pointer; }
.feed-del:hover { color: var(--flag); }

/* ---------- delivery banner ---------- */
.banner {
  font-size: .82rem; padding: .6rem .75rem; border-radius: 9px;
  background: color-mix(in srgb, var(--accent) 10%, var(--card));
  border: 1px solid color-mix(in srgb, var(--accent) 30%, var(--line));
  color: var(--ink-2); margin-bottom: .9rem;
}

/* ---------- digest (front page) ---------- */
.digest-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: .5rem; gap: 1rem; }
.digest-summary { color: var(--ink-3); font-size: .84rem; margin: 0 0 1.4rem; }
.section { margin-bottom: 1.8rem; }
.section-title {
  font-family: "Newsreader", Georgia, serif; font-weight: 600; font-size: 1.15rem;
  border-bottom: 1px solid var(--ink); padding-bottom: .3rem; margin: 0 0 .7rem;
  display: flex; justify-content: space-between; align-items: baseline;
}
.section-count { font-family: "Inter", sans-serif; font-size: .74rem; color: var(--ink-3); font-weight: 400; }
.section-error { color: var(--flag); font-size: .84rem; margin: 0 0 .5rem; }
.article { padding: .55rem 0; border-bottom: 1px solid var(--line-2); }
.article:last-child { border-bottom: none; }
.article a {
  font-family: "Newsreader", Georgia, serif; font-size: 1.12rem; font-weight: 500;
  color: var(--ink); text-decoration: none; line-height: 1.3;
}
.article a:hover { color: var(--accent-ink); text-decoration: underline; }
.article .when { color: var(--ink-3); font-size: .78rem; font-family: "Inter", sans-serif; margin-left: .4rem; }
.article .summary { color: var(--ink-2); font-size: .9rem; margin: .25rem 0 0; }
.section-empty { color: var(--ink-3); font-size: .88rem; }

#digest-empty { color: var(--ink-3); text-align: center; padding: 3rem 0; font-family: "Newsreader", serif; font-size: 1.1rem; }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
