/* Rolling with Scissors News Dispatch — matches rwsradio.com's clean editorial look */
:root {
  --bg: #f5f5f5;
  --card: #ffffff;
  --ink: #111111;
  --muted: #5c5c5c;
  --line: #e2e2e2;
  --link: #1e73be;
  --accent: #111111;
  --accent-ink: #ffffff;
  --beta: #c0392b;
  --good: #1d7a3a;
  --bad: #b3261e;
  --radius: 10px;
  --font: -apple-system, system-ui, "Segoe UI", Helvetica, Arial, sans-serif;
  --read: Georgia, "Iowan Old Style", "Times New Roman", serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 17px/1.55 var(--font);
}
a { color: var(--link); }
a:hover { text-decoration-thickness: 2px; }
code { background: #eee; padding: 1px 5px; border-radius: 4px; font-size: .9em; }
.muted { color: var(--muted); }
.small { font-size: .88rem; }
.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- buttons & inputs ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--accent); color: var(--accent-ink);
  border: 1px solid var(--accent); border-radius: 6px;
  padding: 9px 16px; font: 600 .92rem var(--font);
  cursor: pointer; text-decoration: none; line-height: 1.2;
}
.btn:hover { background: #333; border-color: #333; }
.btn:disabled { opacity: .45; cursor: default; }
.btn-ghost { background: transparent; color: var(--ink); border-color: #c9c9c9; }
.btn-ghost:hover { background: #ececec; border-color: #b5b5b5; }
.btn-danger { background: transparent; color: var(--bad); border-color: #e4b4b0; }
.btn-danger:hover { background: #fbeceb; border-color: var(--bad); }
.btn-sm { padding: 6px 10px; font-size: .84rem; }
.btn.spinning .ico { animation: spin .9s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }

input[type=text], input[type=url], input[type=password], select, textarea {
  font: 16px var(--font); color: var(--ink);
  background: #fff; border: 1px solid #c9c9c9; border-radius: 6px;
  padding: 9px 11px; width: 100%;
}
textarea { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 13px; resize: vertical; }
input:focus, select:focus, textarea:focus, .btn:focus-visible, .tab:focus-visible {
  outline: 3px solid #8fb8e0; outline-offset: 1px;
}
label { display: block; font-weight: 600; font-size: .92rem; margin-bottom: 10px; }
label > input, label > select, label > textarea { margin-top: 5px; font-weight: 400; }

.notice { padding: 10px 12px; border-radius: 6px; background: #f0f0f0; }
.notice.bad { background: #fbeceb; color: var(--bad); }
.notice.good { background: #e8f4ec; color: var(--good); }

/* ---------- header ---------- */
.site-header {
  background: var(--card);
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 20;
}
.header-inner {
  max-width: 1100px; margin: 0 auto; padding: 10px 16px;
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
}
.brand { display: flex; align-items: center; gap: 12px; color: var(--ink); text-decoration: none; margin-right: auto; }
.brand-logo { height: 34px; width: auto; max-width: 60vw; display: block; }
/* The logo already says "Rolling with Scissors", so only show that text if the logo fails to load. */
.brand-logo + .brand-text .brand-name { display: none; }
.brand-logo + .brand-text .brand-sub { font-size: .85rem; }
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-name { font-weight: 800; font-size: 1.2rem; letter-spacing: -.01em; }
.brand-sub { font-size: .78rem; text-transform: uppercase; letter-spacing: .14em; color: var(--muted); font-weight: 700; }
.beta-badge {
  font: 800 .68rem var(--font); letter-spacing: .12em; text-transform: uppercase;
  color: #fff; background: var(--beta); border: 0; border-radius: 4px;
  padding: 4px 7px; cursor: pointer; align-self: center;
}
.header-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

/* ---------- tabs ---------- */
.tabs-bar { background: var(--card); border-bottom: 1px solid var(--line); }
.tabs {
  max-width: 1100px; margin: 0 auto; padding: 0 10px;
  display: flex; gap: 2px; overflow-x: auto; scrollbar-width: thin;
}
.tab {
  appearance: none; background: none; border: 0; border-bottom: 3px solid transparent;
  padding: 12px 12px 10px; font: 600 .95rem var(--font); color: var(--muted);
  cursor: pointer; white-space: nowrap;
}
.tab:hover { color: var(--ink); }
.tab[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--ink); }
.tab .mine { font-size: .7rem; color: var(--link); margin-left: 4px; vertical-align: 1px; }

/* ---------- main ---------- */
.wrap { max-width: 1100px; margin: 0 auto; padding: 18px 16px 60px; }
.status-line { display: flex; flex-wrap: wrap; gap: 6px 16px; align-items: center; margin-bottom: 10px; font-size: .9rem; color: var(--muted); }
.source-chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 16px; }
.chip {
  border: 1px solid #cfcfcf; background: #fff; color: var(--ink);
  border-radius: 999px; padding: 4px 12px; font: 600 .82rem var(--font); cursor: pointer;
}
.chip[aria-pressed="true"] { background: var(--ink); color: #fff; border-color: var(--ink); }

.stories { display: grid; gap: 12px; }
.story {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px 18px;
}
.story-meta { font-size: .8rem; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .06em; margin-bottom: 4px; }
.story-meta .dot { margin: 0 6px; }
.story h3 { margin: 0 0 6px; font-size: 1.15rem; line-height: 1.3; }
.story h3 a { color: var(--ink); text-decoration: none; }
.story h3 a:hover { text-decoration: underline; }
.story p.summary { margin: 0; color: #333; }
.story-actions { margin-top: 10px; display: flex; gap: 8px; flex-wrap: wrap; }
.story.has-img { display: grid; grid-template-columns: minmax(0, 1fr) 220px; gap: 0 18px; align-items: start; }
.story.has-img .story-text { grid-column: 1; grid-row: 1; min-width: 0; }
.story-thumb { grid-column: 2; grid-row: 1; display: block; border-radius: 8px; overflow: hidden; background: #ececec; aspect-ratio: 16 / 10; }
.story-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.check-row { display: flex; gap: 10px; align-items: center; font-weight: 600; margin: 0; cursor: pointer; }
.check-row input { width: 20px; height: 20px; margin: 0; }
.story-body {
  margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line);
  font: 18px/1.7 var(--read); color: #1a1a1a; max-width: 72ch;
}
.story-body p { margin: 0 0 1em; }
.story-body h2, .story-body h3, .story-body h4 { font-family: var(--font); font-size: 1.05rem; margin: 1.2em 0 .4em; }
.story-body blockquote { margin: 0 0 1em; padding-left: 14px; border-left: 3px solid var(--line); color: #444; }

.empty, .loading { background: var(--card); border: 1px dashed #cfcfcf; border-radius: var(--radius); padding: 28px; text-align: center; color: var(--muted); }
.feed-problems { margin-top: 18px; font-size: .88rem; color: var(--muted); }
.feed-problems li { margin-bottom: 3px; }

.site-footer { max-width: 1100px; margin: 0 auto; padding: 20px 16px 40px; font-size: .88rem; color: var(--muted); border-top: 1px solid var(--line); }
.site-footer a { color: var(--muted); }

/* ---------- dialogs ---------- */
.modal-back {
  position: fixed; inset: 0; background: rgba(0,0,0,.55); z-index: 100;
  display: flex; align-items: flex-start; justify-content: center; padding: 4vh 12px; overflow-y: auto;
}
.modal {
  background: var(--card); border-radius: 12px; width: 100%; max-width: 720px;
  box-shadow: 0 20px 60px rgba(0,0,0,.3); position: relative;
}
.modal-head { display: flex; align-items: center; gap: 12px; padding: 18px 22px; border-bottom: 1px solid var(--line); }
.modal-head h2 { margin: 0; font-size: 1.25rem; flex: 1; }
.modal-body { padding: 18px 22px 24px; }
.modal-close { background: none; border: 0; font-size: 1.6rem; line-height: 1; cursor: pointer; color: var(--muted); padding: 4px 8px; }
.modal-close:hover { color: var(--ink); }

.mf-section { padding: 16px 0; border-bottom: 1px solid var(--line); }
.mf-section:last-child { border-bottom: 0; }
.mf-section h3 { margin: 0 0 10px; font-size: 1.05rem; }
.mf-row { display: flex; gap: 8px; align-items: flex-end; flex-wrap: wrap; }
.mf-row > label { flex: 1 1 220px; margin-bottom: 0; }

.tab-manage { border: 1px solid var(--line); border-radius: 8px; margin-bottom: 10px; }
.tab-manage-head { display: flex; align-items: center; gap: 8px; padding: 10px 12px; background: #fafafa; border-radius: 8px 8px 0 0; flex-wrap: wrap; }
.tab-manage-head .tname { font-weight: 700; flex: 1 1 160px; }
.tab-manage-head input { flex: 1 1 160px; width: auto; font-weight: 700; padding: 6px 9px; }
.tab-manage.is-hidden .tab-manage-head .tname, .tab-manage.is-hidden .tab-manage-head input { opacity: .5; text-decoration: line-through; }
.feed-list { list-style: none; margin: 0; padding: 4px 12px 10px; }
.feed-list li { display: flex; gap: 8px; align-items: center; padding: 6px 0; border-bottom: 1px dashed #ececec; font-size: .92rem; }
.feed-list li:last-child { border-bottom: 0; }
.feed-list .fname { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.feed-list .fname small { display: block; color: var(--muted); font-size: .78rem; }
.feed-list li.off .fname { opacity: .5; text-decoration: line-through; }
.tagline { font-size: .7rem; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--link); }

.splash .modal { max-width: 560px; }
.splash-top { background: var(--ink); color: #fff; border-radius: 12px 12px 0 0; padding: 26px 26px 20px; }
.splash-top .beta-badge { cursor: default; }
.splash-top h2 { margin: 10px 0 0; font-size: 1.5rem; line-height: 1.25; }
.splash .modal-body p { margin: 0 0 12px; }
.splash .modal-body ul { margin: 0 0 14px; padding-left: 20px; }
.splash .modal-body li { margin-bottom: 6px; }

.toast {
  position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%);
  background: var(--ink); color: #fff; padding: 10px 18px; border-radius: 8px;
  font-size: .92rem; z-index: 200; box-shadow: 0 8px 24px rgba(0,0,0,.25); max-width: 90vw;
}

/* ---------- help page ---------- */
.help { max-width: 760px; }
.help h1 { font-size: 1.9rem; line-height: 1.2; margin: 10px 0 6px; }
.help h2 { font-size: 1.35rem; margin: 34px 0 8px; padding-top: 10px; border-top: 1px solid var(--line); }
.help h3 { font-size: 1.08rem; margin: 22px 0 6px; }
.help ol li, .help ul li { margin-bottom: 7px; }
.help .toc { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 20px; }
.help .toc ol { margin: 6px 0 0; padding-left: 20px; }
.help .callout { background: var(--card); border-left: 4px solid var(--ink); padding: 12px 16px; border-radius: 0 8px 8px 0; margin: 14px 0; }
.help .callout.beta { border-left-color: var(--beta); }

@media (max-width: 640px) {
  body { font-size: 16px; }
  .brand-logo { height: 24px; }
  .brand-name { font-size: 1.05rem; }
  .header-actions .btn .label { display: none; }
  .story { padding: 14px; }
  .story.has-img { grid-template-columns: 1fr; }
  .story.has-img .story-text { grid-row: 2; }
  .story-thumb { grid-column: 1; grid-row: 1; margin-bottom: 12px; aspect-ratio: 16 / 9; }
  .modal-head, .modal-body { padding-left: 16px; padding-right: 16px; }
}
