/* harb — bundled stylesheet.
 *
 * Themed via CSS custom properties. Selecting a theme:
 *
 *   data-theme="auto"   (default) — follows the OS via
 *                       @media (prefers-color-scheme: dark).
 *                       Polished light by day, dracula-ish at night.
 *   data-theme="light"  — explicit polished light
 *   data-theme="dark"   — explicit dracula-ish dark
 *   data-theme="sepia"  — explicit sepia
 *
 * Drop <config_dir>/overrides/theme.css to override any var. It loads
 * *after* this file so user overrides always win.
 */

/* ---- themes -------------------------------------------------------- */

/* Polished light (also the default for data-theme="auto" in day mode). */
:root,
[data-theme="auto"],
[data-theme="light"] {
  color-scheme: light;
  --bg:         #fafafa;
  --bg-elev:    #ffffff;
  --bg-sunken:  #f0f0f0;
  --fg:         #1d2026;
  --fg-soft:    #3a3f4a;
  --muted:      #6b7280;
  --accent:     #4c6ef5;
  --accent-fg:  #ffffff;
  --accent-soft:#eaf0ff;
  --border:     #e1e4ea;
  --border-strong: #cfd3da;
  --danger:     #c02a3a;
  --ok:         #198754;
  --star:       #d4a017;
  --shadow:     0 1px 2px rgba(0,0,0,0.04), 0 4px 10px rgba(0,0,0,0.04);
  --radius:     6px;
  --focus-ring: 0 0 0 2px var(--accent-soft);
  --font:       system-ui, -apple-system, "Segoe UI", "Inter", sans-serif;
  --mono:       ui-monospace, SFMono-Regular, Menlo, monospace;
}

/* Dracula-ish dark: applied when [data-theme="auto"] resolves to
 * dark via prefers-color-scheme, OR when [data-theme="dark"] is
 * set explicitly. Kept in one variables block so both paths agree
 * pixel-for-pixel. */
@media (prefers-color-scheme: dark) {
  [data-theme="auto"] {
    color-scheme: dark;
    --bg:         #282a36; /* dracula bg */
    --bg-elev:    #313442;
    --bg-sunken:  #21222c;
    --fg:         #f8f8f2;
    --fg-soft:    #d7d8d6;
    --muted:      #8a8fa3;
    --accent:     #bd93f9; /* dracula purple */
    --accent-fg:  #1a1b22;
    --accent-soft:#3a3257;
    --border:     #3a3c4a;
    --border-strong: #4b4d5e;
    --danger:     #ff5555;
    --ok:         #50fa7b;
    --star:       #f1fa8c;
    --shadow:     0 1px 0 rgba(0,0,0,0.4), 0 6px 20px rgba(0,0,0,0.3);
  }
}

[data-theme="dark"] {
  color-scheme: dark;
  --bg:         #282a36;
  --bg-elev:    #313442;
  --bg-sunken:  #21222c;
  --fg:         #f8f8f2;
  --fg-soft:    #d7d8d6;
  --muted:      #8a8fa3;
  --accent:     #bd93f9;
  --accent-fg:  #1a1b22;
  --accent-soft:#3a3257;
  --border:     #3a3c4a;
  --border-strong: #4b4d5e;
  --danger:     #ff5555;
  --ok:         #50fa7b;
  --star:       #f1fa8c;
  --shadow:     0 1px 0 rgba(0,0,0,0.4), 0 6px 20px rgba(0,0,0,0.3);
}

[data-theme="sepia"] {
  color-scheme: light;
  --bg:         #f4ecd8;
  --bg-elev:    #fbf6e6;
  --bg-sunken:  #ece3c8;
  --fg:         #3a2f1f;
  --fg-soft:    #4a3e2c;
  --muted:      #7a6f5f;
  --accent:     #884422;
  --accent-fg:  #fbf6e6;
  --accent-soft:#eaddc1;
  --border:     #c8b89c;
  --border-strong: #b3a085;
  --danger:     #a33;
  --ok:         #5b6e1f;
  --star:       #b8860b;
}

/* ---- reset / base -------------------------------------------------- */

*, *::before, *::after { box-sizing: border-box; }

html, body {
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.55;
  margin: 0;
  padding: 0;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3 { font-weight: 600; line-height: 1.25; margin: 0 0 0.6em; letter-spacing: -0.01em; }
h1 { font-size: 1.6rem; }
h2 { font-size: 1.2rem; }
h3 { font-size: 1.05rem; }
h1 small { font-size: 0.65em; color: var(--muted); font-weight: 400; margin-left: 0.4em; }

p { margin: 0 0 0.8em; }

code, pre {
  font-family: var(--mono);
  font-size: 0.92em;
  background: var(--bg-sunken);
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 0 0.3em;
}
pre { padding: 0.7em 0.9em; overflow-x: auto; }
pre code { border: 0; padding: 0; background: transparent; }

img { max-width: 100%; height: auto; }

::selection { background: var(--accent-soft); color: var(--fg); }

/* ---- header / nav -------------------------------------------------- */

header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1.2em;
  padding: 0.7em 1.4em;
  background: var(--bg-elev);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
  backdrop-filter: saturate(140%) blur(6px);
}
header .brand {
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--accent);
  letter-spacing: -0.01em;
}
header .nav {
  display: flex;
  gap: 1.2em;
  flex: 1;
}
header .nav a {
  color: var(--fg-soft);
  font-size: 0.95rem;
  padding: 0.15em 0.1em;
  border-bottom: 2px solid transparent;
}
header .nav a:hover {
  color: var(--accent);
  text-decoration: none;
  border-bottom-color: var(--accent);
}
header .logout { margin: 0; }
header .logout button {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--muted);
  padding: 0.3em 0.8em;
  border-radius: var(--radius);
  font-size: 0.85rem;
}
header .logout button:hover { color: var(--fg); border-color: var(--border-strong); }
header .theme-toggle {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--muted);
  width: 2em;
  height: 2em;
  padding: 0;
  border-radius: 50%;
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  /* On logged-out pages there is no .nav with `flex: 1` to push us
   * right, so claim the leftover space ourselves. Harmless when
   * .nav is present (margin-left already absorbed by its flex: 1). */
  margin-left: auto;
}
header .theme-toggle:hover { color: var(--fg); border-color: var(--border-strong); }
header .theme-toggle:focus-visible { outline: none; box-shadow: var(--focus-ring); }

/* ---- main / sections ---------------------------------------------- */

main {
  max-width: 60em;
  margin: 1.5em auto;
  padding: 0 1.4em;
}

/* Wider column on list pages (per-feed, all, starred) so the
 * split-panel detail view has room to breathe on big screens. The
 * narrow-screen layout collapses back into a single column via
 * .detail-pane's display:none, so this width is harmless there. */
main.wide { max-width: 78em; }

.site-footer {
  max-width: 60em;
  margin: 2em auto 1.5em;
  padding: 0.6em 1.4em 0;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.8em;
  text-align: center;
}
.site-footer .version { font-family: monospace; }

.empty { color: var(--muted); font-style: italic; }
.err   { color: var(--danger); }
.ok    { color: var(--ok); }
.hint  { color: var(--muted); font-size: 0.9em; }

/* ---- forms / buttons (generic) ------------------------------------ */

button,
input[type="text"],
input[type="url"],
input[type="password"],
input[type="email"],
select {
  font: inherit;
  color: inherit;
  padding: 0.45em 0.75em;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-elev);
  transition: border-color 120ms ease, box-shadow 120ms ease;
}
input:focus, button:focus, select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: var(--focus-ring);
}
button {
  cursor: pointer;
  background: var(--bg-elev);
  font-weight: 500;
}
button:hover { border-color: var(--border-strong); color: var(--fg); }

/* primary submit-style buttons */
button.primary,
.subscribe button,
.login button {
  background: var(--accent);
  color: var(--accent-fg);
  border-color: var(--accent);
}
button.primary:hover,
.subscribe button:hover,
.login button:hover {
  filter: brightness(1.08);
  color: var(--accent-fg);
}

/* ---- login -------------------------------------------------------- */

.login {
  max-width: 22em;
  margin: 3.5em auto;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.6em 1.8em;
  box-shadow: var(--shadow);
}
.login form { display: flex; flex-direction: column; gap: 0.8em; }
.login label { display: flex; flex-direction: column; gap: 0.25em; font-size: 0.9em; color: var(--muted); }

/* ---- home (feed list) --------------------------------------------- */

.home .home-actions {
  display: flex;
  gap: 0.6em;
  margin-bottom: 1.2em;
}
.home-actions .addlink {
  display: inline-block;
  padding: 0.45em 0.9em;
  background: var(--accent);
  color: var(--accent-fg);
  border-radius: var(--radius);
  font-weight: 500;
  font-size: 0.95em;
}
.home-actions .addlink:hover { filter: brightness(1.08); text-decoration: none; }
.home-actions .filter {
  display: inline-block;
  padding: 0.45em 0.9em;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--fg-soft);
  font-size: 0.95em;
}
.home-actions .filter:hover { border-color: var(--accent); color: var(--accent); text-decoration: none; }
.home-actions .filter.active {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent);
}

ul.feeds {
  list-style: none;
  padding: 0;
  margin: 0;
  border-top: 1px solid var(--border);
}
ul.feeds li {
  display: flex;
  align-items: center;
  gap: 0.6em;
  padding: 0.55em 0.3em;
  border-bottom: 1px solid var(--border);
}
ul.feeds li:hover { background: var(--bg-sunken); }
ul.feeds li a { flex: 1; color: var(--fg); }
ul.feeds li a:hover { color: var(--accent); text-decoration: none; }
ul.feeds li.empty {
  display: block;
  text-align: center;
  padding: 1.4em;
  color: var(--muted);
  font-style: italic;
}

.count {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  font-size: 0.85em;
  min-width: 2em;
  text-align: right;
  padding: 0.05em 0.5em;
  background: var(--bg-sunken);
  border-radius: 10px;
}

/* ---- sync-failure surfacing --------------------------------------- */
.sync-fail {
  border: 1px solid var(--danger);
  background: color-mix(in srgb, var(--danger) 8%, var(--bg-elev));
  border-radius: var(--radius);
  padding: 0.7em 0.9em;
  margin: 0 0 1em;
}
.sync-fail-head {
  margin: 0 0 0.3em;
  font-weight: 600;
  color: var(--danger);
}
.sync-fail-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.3em 0.9em;
}
.sync-fail-list a { color: var(--fg); }
.sync-fail-list a:hover { color: var(--danger); text-decoration: none; }

ul.feeds li.feed-failing a { color: var(--danger); }
.sync-warn {
  color: var(--danger);
  cursor: help;
  font-size: 0.95em;
  line-height: 1;
}

form.inline { display: inline; margin: 0; }
.remove {
  background: transparent;
  border: 1px solid transparent;
  color: var(--muted);
  padding: 0 0.45em;
  font-size: 1.05em;
  line-height: 1;
}
.remove:hover { color: var(--danger); border-color: var(--danger); background: transparent; }

/* ---- add-feed page ----------------------------------------------- */

.add-feed {
  max-width: 36em;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.4em 1.6em;
  box-shadow: var(--shadow);
}
.add-feed form { display: flex; flex-direction: column; gap: 0.7em; }
.add-feed label { display: flex; flex-direction: column; gap: 0.25em; font-size: 0.9em; color: var(--muted); }
.add-feed .preview {
  margin-top: 1.4em;
  padding-top: 1.2em;
  border-top: 1px solid var(--border);
}
.add-feed .preview h2 { margin: 0 0 0.4em; }
.add-feed .preview-meta { color: var(--muted); font-size: 0.9em; margin-bottom: 1em; }
.add-feed .preview ul {
  list-style: none; padding: 0; margin: 0;
  font-size: 0.95em;
}
.add-feed .preview li {
  padding: 0.3em 0;
  border-bottom: 1px dashed var(--border);
}
.add-feed .subscribe {
  display: flex; gap: 0.5em; margin-top: 1em;
}

/* ---- feed / entry list -------------------------------------------- */

.markall-form { display: inline; margin: 0; font-size: 0.7em; vertical-align: middle; }
.markall {
  font-size: 0.85em;
  padding: 0.25em 0.7em;
  color: var(--muted);
}

.unsubscribe-form { margin: 0; }
.unsubscribe {
  font-size: 0.85em;
  padding: 0.25em 0.7em;
  color: var(--muted);
}
.unsubscribe:hover { color: var(--danger); border-color: var(--danger); }

ul.entries {
  list-style: none;
  padding: 0;
  margin: 0;
}
.entry {
  display: flex;
  align-items: baseline;
  gap: 0.7em;
  padding: 0.6em 0.3em;
  border-bottom: 1px solid var(--border);
}
.entry:hover { background: var(--bg-sunken); }
.entry > a {
  flex: 1;
  color: var(--fg);
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.entry > a:hover { color: var(--accent); text-decoration: none; }
.entry.read > a { color: var(--muted); font-weight: 400; }
.entry:not(.read) > a { font-weight: 600; }
.entry.starred::before { content: "★ "; color: var(--star); }
/* Touch swipe feedback: the element translates under the finger during
   a committed LEFT swipe (see static/keys.js) and reveals which action
   will fire on release. swipe-read tints + shows a ● hint (short swipe →
   toggle read); swipe-star tints + shows a ★ hint (long swipe → toggle
   star); swipe-open shows a → hint (feed row → enter / drill in). The
   inline transform is cleared on release. touch-action: pan-y lets the
   browser own vertical scrolling while we handle horizontal swipes. */
.entry, .feeds li { touch-action: pan-y; }
.entry, .feeds li, .entry-full { position: relative; }
.entry.swipe-read { background: var(--accent-soft); }
.entry.swipe-star { background: var(--star-soft, var(--accent-soft)); }
.entry-full.swipe-read { background: var(--accent-soft); }
.entry-full.swipe-star { background: var(--star-soft, var(--accent-soft)); }
.feeds li.swipe-open { background: var(--accent-soft); }
/* The action hint glyph, revealed at the trailing (right) edge as the
   element slides left under the finger. */
.entry.swipe-read::after,
.entry.swipe-star::after,
.feeds li.swipe-open::after,
.entry-full.swipe-read::after,
.entry-full.swipe-star::after {
  position: absolute;
  top: 50%;
  right: 0.4em;
  transform: translateY(-50%);
  font-size: 1.1em;
  line-height: 1;
  pointer-events: none;
}
.entry.swipe-read::after, .entry-full.swipe-read::after { content: "●"; color: var(--accent); }
.entry.swipe-star::after, .entry-full.swipe-star::after { content: "★"; color: var(--star); }
.feeds li.swipe-open::after { content: "→"; color: var(--accent); }
.entry.kb-focus {
  background: var(--accent-soft);
  border-left: 3px solid var(--accent);
  padding-left: 0.55em;
}
.feeds li.kb-focus {
  background: var(--accent-soft);
  border-left: 3px solid var(--accent);
  padding-left: calc(0.6em - 3px);
}
.entry .feed-tag {
  color: var(--muted);
  font-size: 0.78em;
  flex-shrink: 0;
  padding: 0.05em 0.45em;
  background: var(--bg-sunken);
  border-radius: 10px;
}
.entry .date {
  color: var(--muted);
  font-size: 0.78em;
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
  min-width: 3em;
  text-align: right;
}
.entry .readbtn,
.entry .starbtn {
  font-size: 0.78em;
  padding: 0.18em 0.55em;
  color: var(--muted);
  flex-shrink: 0;
}

/* ---- split panel (entry list + detail) ---------------------------- */

/* On narrow screens (< 64em) the split collapses: the entries pane
 * takes the full width and .detail-pane is hidden, so clicking an
 * entry follows its href like before. On wide screens we get a
 * two-column grid with the list on the left and a sticky detail pane
 * on the right that htmx populates on row clicks.
 *
 * The hx-trigger expression on each row gates the htmx swap to wide
 * viewports only; below the breakpoint the native <a href> wins. */
.split { display: block; }
.detail-pane { display: none; }

@media (min-width: 64em) {
  .split {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.6fr);
    gap: 1.6em;
    align-items: start;
  }
  .entries-pane { min-width: 0; }
  .detail-pane {
    display: block;
    position: sticky;
    top: 4.2em;
    max-height: calc(100vh - 5em);
    overflow: auto;
    background: var(--bg-elev);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.2em 1.4em;
    box-shadow: var(--shadow);
  }
  .detail-pane .detail-placeholder {
    color: var(--muted);
    font-style: italic;
    text-align: center;
    margin: 2em 0;
  }
  /* Cancel the entry-full max-width when it's living in the right
   * pane — the pane itself constrains the width. */
  .detail-pane .entry-full { max-width: none; margin: 0; }
}

/* ---- home master-detail (feeds left, entry preview right) ---------
 * The home page reuses the .split + .detail-pane machinery: on wide
 * screens the feeds list (left) sits beside #feed-pane (right) which
 * previews the keyboard-selected feed's entries via htmx (?panel=1).
 * Below 64em .detail-pane is display:none, so home collapses back to
 * the plain feeds list and feed links navigate normally. */
.feed-pane .feed-pane-head {
  margin: 0 0 0.6em;
  font-size: 1.05em;
}
.feed-pane .feed-pane-head a { color: var(--fg); }
.feed-pane .feed-pane-head a:hover { color: var(--accent); text-decoration: none; }
.feed-pane .detail-placeholder {
  color: var(--muted);
  font-style: italic;
  text-align: center;
  margin: 2em 0;
}

.entry-full { max-width: 44em; margin: 0 auto; }
.entry-full h1 { margin-bottom: 0.3em; }
.entry-full .meta {
  color: var(--muted);
  font-size: 0.9em;
  margin-bottom: 1em;
  padding-bottom: 0.6em;
  border-bottom: 1px solid var(--border);
}
.entry-full .actions {
  display: flex;
  gap: 0.5em;
  margin-bottom: 1.5em;
}
.entry-full .body {
  font-size: 1.05rem;
  line-height: 1.7;
}
.entry-full .body p { margin: 0 0 1em; }
.entry-full .body blockquote {
  margin: 0 0 1em;
  padding: 0.3em 1em;
  border-left: 3px solid var(--border-strong);
  color: var(--muted);
  background: var(--bg-sunken);
  border-radius: 0 var(--radius) var(--radius) 0;
}
.entry-full .body img { border-radius: var(--radius); margin: 0.5em 0; }
.entry-full .body a { text-decoration: underline; text-decoration-color: var(--accent-soft); text-underline-offset: 3px; }

/* ---- settings page ----------------------------------------------- */

.settings { max-width: 30em; }
.passwd { display: flex; flex-direction: column; gap: 0.7em; max-width: 22em; margin-bottom: 1em; }
.passwd label { display: flex; flex-direction: column; gap: 0.25em; font-size: 0.9em; color: var(--muted); }

/* ---- keyboard-help overlay --------------------------------------- */

#kbd-help {
  position: fixed;
  inset: 50% auto auto 50%;
  transform: translate(-50%, -50%);
  z-index: 100;
  width: min(28em, 90vw);
  max-height: 80vh;
  overflow: auto;
  background: var(--bg-elev);
  color: var(--fg);
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  padding: 1.4em 1.6em;
  box-shadow: 0 16px 50px rgba(0,0,0,0.35);
}
#kbd-help[hidden] { display: none; }
#kbd-help h2 { margin: 0 0 0.7em; }
#kbd-help .kbd-section h3 { margin-top: 0.8em; font-size: 0.85em; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; }
#kbd-help table { width: 100%; border-collapse: collapse; font-size: 0.95em; }
#kbd-help td { padding: 0.2em 0; vertical-align: top; }
#kbd-help td.key { width: 7em; }
#kbd-help kbd {
  display: inline-block;
  padding: 0.1em 0.45em;
  font-family: var(--mono);
  font-size: 0.85em;
  background: var(--bg-sunken);
  border: 1px solid var(--border);
  border-bottom-width: 2px;
  border-radius: 4px;
  margin-right: 0.2em;
}
#kbd-backdrop {
  position: fixed; inset: 0; background: rgba(0,0,0,0.4);
  z-index: 99;
}
#kbd-backdrop[hidden] { display: none; }

/* ---- small screens ------------------------------------------------ */

@media (max-width: 32em) {
  header { gap: 0.6em; padding: 0.5em 0.8em; }
  header .nav { gap: 0.8em; flex-wrap: wrap; }
  main { margin: 1em auto; padding: 0 0.8em; }
  .entry > a { white-space: normal; }
  .entry .feed-tag { display: none; }
}

/* ---- icons for read / star toggles -------------------------------- */
/* Buttons used in entry rows and the entry detail. The glyph itself
   sits inside a <span aria-hidden> so screen readers read the
   aria-label, not the symbol. */
.entry .readbtn.icon,
.entry .starbtn.icon,
.entry-full .readbtn.icon,
.entry-full .starbtn.icon {
  background: transparent;
  border: 1px solid transparent;
  padding: 0.1em 0.4em;
  font-size: 1em;
  line-height: 1;
  color: var(--muted);
}
.entry .readbtn.icon span,
.entry .starbtn.icon span {
  font-size: 1.1em;
}
.entry .readbtn.icon:hover,
.entry .starbtn.icon:hover { color: var(--fg); border-color: var(--border); }
.entry.unread .readbtn.icon { color: var(--accent); }
.entry.read .readbtn.icon { color: var(--muted); }
.entry.starred .starbtn.icon { color: #d6a82c; }
.entry-full.starred .starbtn.icon { color: #d6a82c; }

/* ---- tag groups on the home page --------------------------------- */
.feed-groups { display: flex; flex-direction: column; gap: 1.1em; min-width: 0; }
.feed-group { border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg-elev); overflow: hidden; }
.feed-group-head {
  display: flex; align-items: center; gap: 0.5em;
  margin: 0; padding: 0.5em 0.8em;
  background: var(--bg-sunken);
  border-bottom: 1px solid var(--border);
  font-size: 0.95rem; font-weight: 600;
}
.feed-group-head .count { margin-left: auto; }
.feed-group-toggle {
  flex: 1;
  display: inline-flex; align-items: center; gap: 0.45em;
  background: transparent; border: none; padding: 0;
  font: inherit; color: var(--fg);
  text-align: left; cursor: pointer;
}
.feed-group-toggle:hover { color: var(--accent); }
.feed-group-toggle .caret { display: inline-block; width: 0.9em; color: var(--muted); transition: transform 120ms ease; }
.feed-group-toggle[aria-expanded="false"] .caret { transform: rotate(-90deg); }
.feed-group .feeds { border-top: none; }
.feed-group .feeds[hidden] { display: none; }
.feed-group .feeds li { padding-left: 0.8em; padding-right: 0.8em; }

/* ---- tag chips on a feed ----------------------------------------- */
.tagchips {
  display: flex; flex-wrap: wrap; gap: 0.4em; align-items: center;
  margin: 0.6em 0 1em;
}
.tagchip {
  display: inline-flex; align-items: center; gap: 0.25em;
  padding: 0.1em 0.55em;
  background: var(--bg-sunken);
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 0.82em;
  color: var(--fg-soft);
}
.tagchip-rm { display: inline; margin: 0; }
.tagchip-x {
  background: transparent;
  border: none;
  color: var(--muted);
  font-size: 0.95em;
  line-height: 1;
  padding: 0 0.15em;
  opacity: 0;            /* hidden until the chip is hovered/focused */
  transition: opacity 100ms ease, color 100ms ease;
  cursor: pointer;
}
.tagchip:hover .tagchip-x,
.tagchip:focus-within .tagchip-x { opacity: 0.6; }
.tagchip .tagchip-x:hover,
.tagchip .tagchip-x:focus { opacity: 1; color: var(--danger); border-color: transparent; background: transparent; }
.tagadd { display: inline; margin: 0; }
.tagadd input[type="text"] {
  padding: 0.15em 0.55em;
  font-size: 0.82em;
  border-radius: 999px;
  background: transparent;
}

/* Used in the entry-list rendering to dim already-read rows. */
.entry.read > a { color: var(--muted); }

/* ---- feed management disclosure ----------------------------------- */
/* All feed-admin controls (URL, rename, tags, unsubscribe) tuck behind
   a single native <details> so the reading view stays uncluttered. Works
   with JS off. */
.feed-manage {
  margin: 0.2em 0 0.9em;
}
.feed-manage-summary {
  display: inline-flex;
  align-items: center;
  gap: 0.4em;
  width: fit-content;
  cursor: pointer;
  list-style: none;
  font-size: 0.8em;
  padding: 0.3em 0.7em;
  color: var(--muted);
  background: var(--bg-sunken);
  border: 1px solid var(--border);
  border-radius: 4px;
  user-select: none;
}
.feed-manage-summary::-webkit-details-marker { display: none; }
.feed-manage-summary:hover { border-color: var(--accent); color: var(--accent); }
.feed-manage-summary:focus-visible { outline: none; border-color: var(--accent); box-shadow: var(--focus-ring); }
.feed-manage-gear {
  display: inline-block;
  transition: transform 0.15s ease;
}
.feed-manage[open] > .feed-manage-summary { color: var(--fg); }
.feed-manage[open] > .feed-manage-summary .feed-manage-gear { transform: rotate(60deg); }
.feed-manage-body {
  margin-top: 0.7em;
  padding-top: 0.2em;
}

/* ---- feed source (copyable RSS URL) ------------------------------- */
.feed-source {
  display: flex;
  align-items: center;
  gap: 0.5em;
  margin: 0.2em 0 0.9em;
  min-width: 0;
}
.feed-source-label {
  font-size: 0.75em;
  font-weight: 600;
  letter-spacing: 0.05em;
  color: var(--muted);
  flex: none;
}
.feed-source .feed-url {
  flex: 1;
  min-width: 0;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.82em;
  padding: 0.3em 0.5em;
  color: var(--fg);
  background: var(--bg-sunken);
  border: 1px solid var(--border);
  border-radius: 4px;
}
.feed-source .copy-url {
  flex: none;
  font-size: 0.8em;
  padding: 0.35em 0.7em;
  cursor: pointer;
  color: var(--fg);
  background: var(--bg-sunken);
  border: 1px solid var(--border);
  border-radius: 4px;
}
.feed-source .copy-url:hover { border-color: var(--accent); color: var(--accent); }
.feed-source .copy-url.copied { color: var(--accent); border-color: var(--accent); }

.rename-form {
  display: flex;
  align-items: center;
  gap: 0.5em;
  margin: 0 0 0.9em;
  min-width: 0;
}
.rename-form .rename-title {
  flex: 1;
  min-width: 0;
  font-size: 0.9em;
  padding: 0.3em 0.5em;
  color: var(--fg);
  background: var(--bg-sunken);
  border: 1px solid var(--border);
  border-radius: 4px;
}
.rename-form .rename-save {
  flex: none;
  font-size: 0.8em;
  padding: 0.35em 0.7em;
  cursor: pointer;
  color: var(--fg);
  background: var(--bg-sunken);
  border: 1px solid var(--border);
  border-radius: 4px;
}
.rename-form .rename-save:hover { border-color: var(--accent); color: var(--accent); }
/* auto-refresh pill — unobtrusive "new items" affordance, fixed to the
   bottom centre. Small and dismissable; mobile-friendly. */
#refresh-pill {
  position: fixed;
  left: 50%;
  bottom: max(1rem, env(safe-area-inset-bottom));
  transform: translateX(-50%);
  z-index: 50;
  display: flex;
  align-items: stretch;
  gap: 0;
  max-width: calc(100vw - 2rem);
  background: var(--accent);
  color: var(--accent-fg);
  border-radius: 999px;
  box-shadow: var(--shadow);
  overflow: hidden;
}
#refresh-pill[hidden] { display: none; }
.refresh-pill-btn,
.refresh-pill-x {
  background: transparent;
  border: 0;
  color: inherit;
  font: inherit;
  cursor: pointer;
  padding: 0.5rem 0.9rem;
  line-height: 1.2;
  white-space: nowrap;
}
.refresh-pill-btn { font-weight: 600; }
.refresh-pill-x {
  padding-inline: 0.7rem;
  opacity: 0.8;
  border-left: 1px solid color-mix(in srgb, var(--accent-fg) 30%, transparent);
}
.refresh-pill-btn:hover,
.refresh-pill-x:hover { background: color-mix(in srgb, var(--accent-fg) 14%, transparent); }
.refresh-pill-x:hover { opacity: 1; }
