/* ═══════════════════════════════════════════════════════════
   DevFeed — Notion-Styled Developer News Hub
   ═══════════════════════════════════════════════════════════ */

/* ─── CSS VARIABLES ─── */
:root {
  --bg-primary:      #0f0f12;
  --bg-secondary:    #16161a;
  --bg-card:         #1a1a1f;
  --bg-card-hover:   #20202a;
  --bg-panel:        #13131a;

  --text-primary:    #e8e8ec;
  --text-secondary:  #8a8a95;
  --text-muted:      #5c5c66;

  --accent-violet:   #a78bfa;
  --accent-blue:     #60a5fa;
  --accent-green:    #34d399;
  --accent-orange:   #fb923c;
  --accent-pink:     #f472b6;

  --border:          rgba(255,255,255,0.06);
  --border-hover:    rgba(255,255,255,0.20);

  --radius-card:     12px;
  --radius-tab:      8px;
  --radius-btn:      6px;

  --font-sans:       'DM Sans', sans-serif;
  --font-serif:      'Fraunces', serif;
  --font-mono:       'Source Code Pro', monospace;

  --current-font:    var(--font-sans);
  --current-size:    15px;

  --panel-width:     380px;
  --topbar-h:        56px;
  --tabs-h:          48px;

  --transition:      200ms cubic-bezier(.4,0,.2,1);
}

/* ─── RESET & BASE ─── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

body {
  font-family: var(--current-font);
  font-size: var(--current-size);
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  transition: background var(--transition), color var(--transition);
}

body * { font-size: inherit; }

.card-meta,
.card-meta .meta-site,
.card-meta .meta-sep,
.card-meta .meta-tag,
.card-footer,
.tab,
.tab .tab-count,
.setting-label,
.toggle-btn,
.size-label,
.source-group-title,
.source-row label,
.add-topic-wrap input,
.add-topic-wrap button,
.refresh-btn,
.disclaimer p,
.site-footer,
.site-footer-inner,
.site-footer-inner span,
.footer-brand,
.footer-credit,
.footer-gh,
.panel-header h2,
.panel-close,
.reader-back,
.reader-ext-link,
.reader-meta,
.reader-meta .rmeta-site,
.reader-meta .rmeta-date {
  font-size: unset;
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }

/* ─── TOPBAR ─── */
.topbar {
  position: fixed;
  top: 0;
  z-index: 100;
  width: 100%;
  height: var(--topbar-h);
  background: rgba(15,15,18,.82);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border-bottom: 1px solid var(--border);
}

.topbar-inner {
  max-width: 960px;
  margin: 0 auto;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
}

.topbar-brand { display: flex; align-items: center; gap: 10px; }
.brand-icon { width: 28px; height: 28px; }
.brand-name { font-family: var(--font-sans); font-weight: 600; font-size: 18px; letter-spacing: -0.3px; color: var(--text-primary); }
.topbar-actions { display: flex; gap: 6px; }

.icon-btn {
  width: 38px; height: 38px;
  display: flex; align-items: center; justify-content: center;
  background: transparent; border: 1px solid var(--border);
  border-radius: var(--radius-tab);
  color: var(--text-secondary); cursor: pointer;
  transition: background var(--transition), color var(--transition), border-color var(--transition);
}
.icon-btn:hover { background: var(--bg-card); color: var(--text-primary); border-color: var(--border-hover); }
.icon-btn svg { width: 18px; height: 18px; }

/* ─── TABS ─── */
.tabs-wrap {
  position: -webkit-sticky;
  position: sticky; top: var(--topbar-h); z-index: 90;
  background: rgba(15,15,18,.78);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
  overflow-x: auto; -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.tabs-wrap::-webkit-scrollbar { display: none; }
.tabs {
  max-width: 960px; margin: 0 auto;
  display: flex; gap: 6px;
  padding: 8px 20px;
  min-width: -webkit-max-content;
  min-width: -moz-max-content;
  min-width: max-content;
}
.tab {
  display: flex; align-items: center; gap: 7px;
  padding: 7px 14px;
  border-radius: var(--radius-tab);
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-secondary);
  font-family: var(--font-sans); font-size: 13px; font-weight: 500;
  cursor: pointer; white-space: nowrap;
  transition: all var(--transition);
}
.tab:hover { background: var(--bg-card); color: var(--text-primary); border-color: var(--border); }
.tab.active { background: var(--bg-card); color: var(--text-primary); border-color: var(--border-hover); box-shadow: 0 1px 3px rgba(0,0,0,.25); }
.tab .tab-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.tab .tab-count { font-size: 11px; background: rgba(255,255,255,.08); padding: 1px 6px; border-radius: 10px; color: var(--text-muted); }

/* ─── FEED ─── */
.feed-container { max-width: 960px; margin: 56px auto 0 auto; padding: 24px 20px 40px; }
.feed { display: grid; gap: 14px; }

/* ─── CARD ─── */
.card {
  display: grid; grid-template-columns: 200px 1fr; gap: 18px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  overflow: hidden; cursor: pointer;
  transition: background var(--transition), border-color var(--transition), transform var(--transition), box-shadow var(--transition), opacity 0.3s ease;
  -webkit-animation: cardIn .35s cubic-bezier(.4,0,.2,1) both;
          animation: cardIn .35s cubic-bezier(.4,0,.2,1) both;
}
.card:hover { background: var(--bg-card-hover); border-color: var(--border-hover); transform: translateY(-2px); box-shadow: 0 6px 24px rgba(0,0,0,.28); }
@-webkit-keyframes cardIn { from { opacity:0; transform: translateY(12px); } to { opacity:1; transform: translateY(0); } }
@keyframes cardIn { from { opacity:0; transform: translateY(12px); } to { opacity:1; transform: translateY(0); } }

.card-img-wrap { height: 100%; min-height: 140px; overflow: hidden; background: var(--bg-secondary); position: relative; }
.card-img-wrap img { width: 100%; height: 100%; -o-object-fit: cover; object-fit: cover; transition: transform 400ms ease, opacity 0.4s ease, -webkit-filter 0.4s ease; transition: transform 400ms ease, filter 0.4s ease, opacity 0.4s ease; transition: transform 400ms ease, filter 0.4s ease, opacity 0.4s ease, -webkit-filter 0.4s ease; }
.card:hover .card-img-wrap img { transform: scale(1.04); }
.card-img-placeholder { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; font-size: 36px; background: linear-gradient(135deg, var(--bg-secondary), var(--bg-card)); color: var(--text-muted); }

.card-body { padding: 16px 18px 16px 0; display: flex; flex-direction: column; justify-content: center; gap: 8px; }

.card-meta { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--text-muted); font-family: var(--font-sans); }

/* ─── READ INDICATOR ─── */
.card-meta .read-indicator {
  font-size: 24px;
  line-height: 1;
  width: 32px;
  text-align: center;
  font-weight: bold;
  color: #777;
  cursor: pointer;
  transition: all 0.22s ease;
  -webkit-user-select: none;
     -moz-user-select: none;
      -ms-user-select: none;
          user-select: none;
}

.card-meta .read-indicator.unread {
  color: #c084fc;           /* brighter violet when unread */
  opacity: 0.92;
}

.card-meta .read-indicator:hover {
  color: #ddd6fe;
  transform: scale(1.18);
}

/* ─── READ ARTICLE VISUAL DISTINCTION ─── */
.card.read-article {
  opacity: 0.80;
  background: #1a1a1f;
  border-color: rgba(167,139,250, 0.10);
}

.card.read-article:hover {
  opacity: 0.94;
  background: var(--bg-card);
  transform: translateY(-1px);
}

.card.read-article .card-img-wrap {
  -webkit-filter: grayscale(100%);
  filter: grayscale(100%);
}
.card.read-article img {
  -webkit-filter: grayscale(100%);
          filter: grayscale(100%);
  opacity: 0.72;
}

.card.read-article .card-title {
  color: #9ca3af !important;
  opacity: 0.85;
}

.card.read-article .card-title:hover {
  color: #c4b5fd !important;
  opacity: 1;
}

.card.read-article .card-desc {
  color: #6b7280;
  opacity: 0.70;
}

.card.read-article .card-footer,
.card.read-article .footer-link {
  color: #6b7280;
  opacity: 0.60;
}

.card.read-article .footer-link:hover {
  color: #a78bfa;
  opacity: 0.85;
  text-decoration: underline;
}

.card-meta .meta-favicon { width: 16px; height: 16px; border-radius: 3px; -o-object-fit: contain; object-fit: contain; background: var(--bg-secondary); }
.card-meta .meta-site { font-weight: 999; color: var(--text-secondary); font-size: 12px; }
.card-meta .meta-sep { opacity: .35; font-size: 12px; }
.card-meta .meta-tag { padding: 2px 8px; border-radius: 10px; font-size: 11px; font-weight: 500; margin-left: auto; }

.card-title {
  font-family: var(--current-font);
  font-size: var(--current-size);
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  transition: color var(--transition);
}
.card:hover .card-title { color: var(--accent-violet); }

.card-desc {
  font-family: var(--current-font);
  font-size: calc(var(--current-size) - 2px);
  color: var(--text-secondary);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-footer { margin-top: auto; font-size: 11px; color: var(--text-muted); font-family: var(--font-sans); display: flex; align-items: center; gap: 10px; }
.card-footer .footer-link { color: var(--accent-violet); font-weight: 500; opacity: .7; transition: opacity var(--transition); font-size: 11px; }
.card-footer .footer-link:hover { opacity: 1; }

/* ─── FEED EMPTY ─── */
.feed-empty { text-align: center; padding: 80px 20px; color: var(--text-muted); }
.feed-empty p { font-size: 16px; margin-top: 16px; color: var(--text-secondary); }
.feed-empty span { font-size: 13px; }

/* ─── PANELS (Settings / Reader Prefs) ─── */
.panel { position: fixed; inset: 0; z-index: 999; pointer-events: none; }
.panel.open { pointer-events: auto; }

.panel-overlay { position: absolute; inset: 0; background: rgba(0,0,0,.5); opacity: 0; transition: opacity var(--transition); }
.panel.open .panel-overlay { opacity: 1; }

.panel-content {
  position: absolute; top: 0; right: -100%;
  width: var(--panel-width); max-width: 90vw; height: 100%;
  background: var(--bg-panel);
  border-left: 1px solid var(--border);
  display: flex; flex-direction: column;
  transition: right 280ms cubic-bezier(.4,0,.2,1);
  overflow-y: auto;
}
.panel.open .panel-content { right: 0; }

.panel-header { display: flex; align-items: center; justify-content: space-between; padding: 20px 24px; border-bottom: 1px solid var(--border); position: -webkit-sticky; position: sticky; top: 0; background: var(--bg-panel); z-index: 2; }
.panel-header h2 { font-family: var(--font-sans); font-size: 16px; font-weight: 600; color: var(--text-primary); }

.panel-close { width: 30px; height: 30px; display: flex; align-items: center; justify-content: center; background: transparent; border: none; border-radius: var(--radius-btn); color: var(--text-muted); font-size: 22px; cursor: pointer; transition: background var(--transition), color var(--transition); }
.panel-close:hover { background: var(--bg-card); color: var(--text-primary); }

.panel-body { padding: 24px; flex: 1; }

/* ─── SETTING LABELS ─── */
.setting-label { display: block; font-family: var(--font-sans); font-size: 12px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: .8px; margin-bottom: 10px; margin-top: 20px; }
.setting-label:first-child { margin-top: 0; }

/* ─── TOGGLE GROUP ─── */
.toggle-group { display: flex; background: var(--bg-card); border-radius: var(--radius-tab); padding: 3px; gap: 2px; }
.toggle-btn { flex: 1; padding: 7px 0; text-align: center; font-family: var(--font-sans); font-size: 13px; font-weight: 500; color: var(--text-muted); background: transparent; border: none; border-radius: var(--radius-btn); cursor: pointer; transition: all var(--transition); }
.toggle-btn:hover { color: var(--text-primary); }
.toggle-btn.active { background: var(--bg-secondary); color: var(--text-primary); box-shadow: 0 1px 4px rgba(0,0,0,.3); }

/* ─── SLIDER ─── */
.size-slider-wrap { display: flex; align-items: center; gap: 10px; }
.size-label { font-size: 12px; color: var(--text-muted); font-family: var(--font-sans); min-width: 36px; }
.size-label:last-child { text-align: right; }

input[type=range] { -webkit-appearance: none; flex: 1; height: 4px; background: var(--bg-card); border-radius: 2px; outline: none; }
input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 18px; height: 18px; border-radius: 50%; background: var(--accent-violet); cursor: pointer; box-shadow: 0 2px 6px rgba(167,139,250,.4); -webkit-transition: transform var(--transition); transition: transform var(--transition); }
input[type=range]::-webkit-slider-thumb:hover { transform: scale(1.15); }
input[type=range]::-moz-range-thumb { width: 18px; height: 18px; border-radius: 50%; background: var(--accent-violet); border: none; cursor: pointer; box-shadow: 0 2px 6px rgba(167,139,250,.4); }

.size-preview {
  margin-top: 10px; padding: 10px 14px;
  background: var(--bg-card); border-radius: var(--radius-btn);
  color: var(--text-primary);
  font-family: var(--current-font);
  font-size: var(--current-size);
  text-align: center;
  transition: font-size var(--transition), font-family var(--transition);
}

/* ─── BG SWATCHES ─── */
.color-swatches { display: flex; flex-wrap: wrap; gap: 10px; }
.swatch {
  width: 42px; height: 42px;
  border-radius: 10px;
  border: 2px solid var(--border);
  cursor: pointer;
  position: relative;
  transition: border-color var(--transition), transform var(--transition), box-shadow var(--transition);
}
.swatch:hover { border-color: var(--border-hover); transform: scale(1.08); }
.swatch.active { border-color: var(--accent-violet); box-shadow: 0 0 0 3px rgba(167,139,250,.35); }

.swatch-label {
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%; transform: translateX(-50%);
  background: #1e1e24;
  color: #e8e8ec;
  font-family: var(--font-sans);
  font-size: 11px !important;
  font-weight: 500;
  white-space: nowrap;
  padding: 3px 8px;
  border-radius: 5px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 150ms ease;
  box-shadow: 0 2px 8px rgba(0,0,0,.35);
}
.swatch-label::after {
  content: '';
  position: absolute;
  top: 100%; left: 50%; transform: translateX(-50%);
  border: 4px solid transparent;
  border-top-color: #1e1e24;
}
.swatch:hover .swatch-label { opacity: 1; }

.swatch[data-bg="#fafafa"],
.swatch[data-bg="#f5f0eb"] { border-color: rgba(0,0,0,.18); }
.swatch[data-bg="#fafafa"].active,
.swatch[data-bg="#f5f0eb"].active { border-color: var(--accent-violet); }

/* ─── SETTINGS: TOPIC MANAGER ─── */
.topic-list { display: flex; flex-direction: column; gap: 6px; }
.topic-row { display: flex; align-items: center; gap: 10px; padding: 8px 10px; background: var(--bg-card); border-radius: var(--radius-btn); border: 1px solid var(--border); transition: border-color var(--transition); }
.topic-row:hover { border-color: var(--border-hover); }
.topic-row .t-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.topic-row .t-name { font-size: 13px; font-weight: 500; color: var(--text-primary); flex: 1; font-family: var(--font-sans); }
.topic-row .t-toggle { width: 38px; height: 22px; border-radius: 11px; background: var(--bg-secondary); border: none; cursor: pointer; position: relative; transition: background var(--transition); }
.topic-row .t-toggle::after { content:''; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: var(--text-muted); transition: all var(--transition); }
.topic-row .t-toggle.on { background: var(--accent-violet); }
.topic-row .t-toggle.on::after { left: 19px; background: #fff; }

.source-group { margin-top: 8px; }
.source-group-title { font-size: 11px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: .6px; padding: 6px 10px 4px; font-family: var(--font-sans); }
.source-row { display: flex; align-items: center; gap: 8px; padding: 6px 10px; border-radius: var(--radius-btn); transition: background var(--transition); }
.source-row:hover { background: rgba(255,255,255,.03); }
.source-row input[type=checkbox] { width: 15px; height: 15px; accent-color: var(--accent-violet); cursor: pointer; }
.source-row label { font-size: 12px; color: var(--text-secondary); cursor: pointer; font-family: var(--font-sans); }

.add-topic-wrap { margin-top: 18px; display: flex; gap: 8px; }
.add-topic-wrap input { flex: 1; padding: 8px 12px; background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-btn); color: var(--text-primary); font-family: var(--font-sans); font-size: 13px; outline: none; transition: border-color var(--transition); }
.add-topic-wrap input:focus { border-color: var(--accent-violet); }
.add-topic-wrap input::-webkit-input-placeholder { color: var(--text-muted); }
.add-topic-wrap input::-moz-placeholder { color: var(--text-muted); }
.add-topic-wrap input:-ms-input-placeholder { color: var(--text-muted); }
.add-topic-wrap input::-ms-input-placeholder { color: var(--text-muted); }
.add-topic-wrap input::placeholder { color: var(--text-muted); }
.add-topic-wrap button { padding: 8px 16px; background: var(--accent-violet); border: none; border-radius: var(--radius-btn); color: #fff; font-family: var(--font-sans); font-size: 13px; font-weight: 600; cursor: pointer; transition: background var(--transition); }
.add-topic-wrap button:hover { background: #9580e6; }

.refresh-btn { margin-top: 22px; width: 100%; padding: 10px; background: transparent; border: 1px solid var(--border); border-radius: var(--radius-btn); color: var(--text-secondary); font-family: var(--font-sans); font-size: 13px; font-weight: 500; cursor: pointer; transition: all var(--transition); display: flex; align-items: center; justify-content: center; gap: 6px; }
.refresh-btn:hover { border-color: var(--accent-violet); color: var(--accent-violet); background: rgba(167,139,250,.08); }
.refresh-btn svg { width: 14px; height: 14px; }

/* ─── DISCLAIMER ─── */
.disclaimer { max-width: 960px; margin: 0 auto; padding: 0 20px 16px; }
.disclaimer p { font-size: 11px; color: var(--text-muted); line-height: 1.6; font-family: var(--font-sans); border-top: 1px solid var(--border); padding-top: 16px; }
.disclaimer strong { color: var(--text-secondary); }

/* ─── SITE FOOTER ─── */
.site-footer { padding: 18px 20px 24px; }
.site-footer-inner {
  max-width: 960px; margin: 0 auto;
  display: flex; align-items: center; justify-content: center; gap: 10px;
  border-top: 1px solid var(--border);
  padding-top: 18px;
}
.footer-brand { display: flex; align-items: center; gap: 6px; font-family: var(--font-sans); font-size: 13px; font-weight: 600; color: var(--text-secondary); }
.footer-brand-icon { width: 18px; height: 18px; }
.footer-sep { color: var(--text-muted); font-size: 13px; }
.footer-credit { font-family: var(--font-sans); font-size: 13px; color: var(--text-muted); display: flex; align-items: center; gap: 6px; }
.footer-gh { display: flex; align-items: center; gap: 5px; color: var(--accent-violet); font-weight: 600; transition: color var(--transition); font-size: 13px; }
.footer-gh:hover { color: #c4b5fd; }
.footer-gh-icon { width: 15px; height: 15px; }

/* ─── LOADING SKELETON ─── */
.card.skeleton { cursor: default; -webkit-animation: none; animation: none; opacity: .5; }
.card.skeleton .card-img-wrap { background: var(--bg-secondary); }
.skeleton-line { height: 12px; border-radius: 6px; background: linear-gradient(90deg, var(--bg-card) 25%, var(--bg-card-hover) 50%, var(--bg-card) 75%); background-size: 200% 100%; -webkit-animation: shimmer 1.4s infinite; animation: shimmer 1.4s infinite; }
@-webkit-keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }

/* ═══════════════════════════════════════════════════════════
   IN-APP ARTICLE READER MODAL
   ═══════════════════════════════════════════════════════════ */
.reader-modal {
  position: fixed; inset: 0; z-index: 600;
  background: var(--bg-primary);
  overflow-y: auto;
  opacity: 0;
  pointer-events: none;
  transform: translateY(18px);
  transition: opacity 260ms ease, transform 260ms ease;
}
.reader-modal.open { opacity: 1; pointer-events: auto; transform: translateY(0); }

.reader-modal-inner { max-width: 720px; margin: 0 auto; padding: 0 24px 80px; }

/* reader top-bar */
.reader-topbar {
  position: -webkit-sticky;
  position: sticky;
  top: 0;
  background: var(--bg-primary);
  z-index: 10;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.reader-back {
  display: flex; align-items: center; gap: 6px;
  background: none; border: none;
  color: var(--text-secondary);
  font-family: var(--font-sans); font-size: 14px; font-weight: 500;
  cursor: pointer;
  transition: color var(--transition);
}
.reader-back:hover { color: var(--accent-violet); }
.reader-back svg { width: 18px; height: 18px; }

.reader-sticky-title {
  font-size: 1.1em;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 45vw;
}

.reader-actions { display: flex; align-items: center; gap: 4px; }

.reader-settings-btn {
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-tab);
  color: var(--text-secondary);
  cursor: pointer;
  transition: background var(--transition), color var(--transition), border-color var(--transition);
}

.reader-settings-btn:hover {
  background: var(--bg-card);
  color: var(--text-primary);
  border-color: var(--border-hover);
}

.reader-settings-btn svg { width: 18px; height: 18px; }

.reader-ext-link {
  display: flex; align-items: center; gap: 6px;
  color: var(--accent-violet);
  font-family: var(--font-sans); font-size: 13px; font-weight: 500;
  transition: color var(--transition);
}
.reader-ext-link:hover { color: #c4b5fd; }
.reader-ext-link svg { width: 16px; height: 16px; }

/* reader meta row */
.reader-meta {
  display: flex; align-items: center; gap: 10px;
  margin: 16px 0;
  font-family: var(--font-sans); font-size: 13px; color: var(--text-muted);
}
.reader-meta .rmeta-favicon { width: 22px; height: 22px; border-radius: 5px; -o-object-fit: contain; object-fit: contain; background: var(--bg-secondary); }
.reader-meta .rmeta-site { font-weight: 600; color: var(--text-secondary); font-size: 13px; }
.reader-meta .rmeta-sep { opacity: .4; font-size: 13px; }
.reader-meta .rmeta-date { font-size: 12px; }

/* reader heading (fallback) */
.reader-title {
  font-family: var(--current-font);
  font-size: calc(var(--current-size) + 10px);
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.3;
  margin-bottom: 24px;
}

/* reader featured image */
.reader-featured-img {
  width: 100%; max-height: 380px;
  -o-object-fit: cover;
     object-fit: cover;
  border-radius: var(--radius-card);
  margin-bottom: 24px;
  background: var(--bg-secondary);
}

/* reader article text */
.reader-body {
  font-family: var(--current-font);
  font-size: var(--current-size);
  color: var(--text-secondary);
  line-height: 1.8;
}
.reader-body p { margin-bottom: 1em; }
.reader-body h2,
.reader-body h3,
.reader-body h4 { color: var(--text-primary); margin: 1.2em 0 .5em; line-height: 1.3; }
.reader-body a { color: var(--accent-violet); }
.reader-body a:hover { text-decoration: underline; }
.reader-body img { border-radius: 8px; margin: 12px 0; max-height: 400px; -o-object-fit: cover; object-fit: cover; }
.reader-body ul, .reader-body ol { padding-left: 22px; margin-bottom: 1em; }
.reader-body li { margin-bottom: .4em; }
.reader-body code { background: var(--bg-card); padding: 2px 7px; border-radius: 4px; font-family: var(--font-mono); font-size: .88em; color: var(--accent-pink); }
.reader-body pre { background: var(--bg-card); padding: 14px; border-radius: 8px; overflow-x: auto; margin-bottom: 1em; }
.reader-body pre code { background: none; padding: 0; color: var(--text-secondary); font-size: .88em; }
.reader-body blockquote { border-left: 3px solid var(--accent-violet); padding: 8px 16px; margin: 12px 0; background: rgba(167,139,250,.06); border-radius: 0 6px 6px 0; color: var(--text-secondary); }

/* reader loading / fallback */
.reader-loading { text-align: center; padding: 60px 0; color: var(--text-muted); font-family: var(--font-sans); font-size: 14px; }
.reader-loading .loader { width: 36px; height: 36px; border: 3px solid var(--border); border-top-color: var(--accent-violet); border-radius: 50%; -webkit-animation: spin .7s linear infinite; animation: spin .7s linear infinite; margin: 0 auto 16px; }
@-webkit-keyframes spin { to { transform: rotate(360deg); } }
@keyframes spin { to { transform: rotate(360deg); } }

.reader-fallback { text-align: center; padding: 50px 0; color: var(--text-muted); font-family: var(--font-sans); font-size: 14px; }
.reader-fallback p { margin-bottom: 16px; color: var(--text-secondary); }

/* ─── LIGHT / PARCHMENT MODE ─── */
body.light-mode {
  --bg-primary:#fafafa; --bg-secondary:#f0f0f0; --bg-card:#ffffff; --bg-card-hover:#f7f7fa; --bg-panel:#ffffff;
  --text-primary:#1a1a1f; --text-secondary:#4a4a55; --text-muted:#7a7a85;
  --border:rgba(0,0,0,.08); --border-hover:rgba(0,0,0,.16);
}
body.light-mode .topbar { background: rgba(250,250,250,.88); }
body.light-mode .tabs-wrap { background: rgba(250,250,250,.85); }
body.light-mode .panel-content { background: #fff; }
body.light-mode .panel-header { background: #fff; }
body.light-mode .reader-modal { background: #fafafa; }
body.light-mode .reader-topbar { background: #fafafa; }

body.parchment-mode {
  --bg-primary:#f5f0eb; --bg-secondary:#ebe5dc; --bg-card:#fdfbf8; --bg-card-hover:#f0ebe4; --bg-panel:#fdfbf8;
  --text-primary:#2a2520; --text-secondary:#5a524a; --text-muted:#8a826e;
  --border:rgba(90,82,74,.1); --border-hover:rgba(90,82,74,.2);
}
body.parchment-mode .topbar { background: rgba(245,240,235,.88); }
body.parchment-mode .tabs-wrap { background: rgba(245,240,235,.85); }
body.parchment-mode .panel-content { background: #fdfbf8; }
body.parchment-mode .panel-header { background: #fdfbf8; }
body.parchment-mode .reader-modal { background: #f5f0eb; }
body.parchment-mode .reader-topbar { background: #f5f0eb; }

/* ─── RESPONSIVE ─── */
@media (max-width: 680px) {
  .card { grid-template-columns: 1fr; }
  .card-img-wrap { height: 160px; min-height: 160px; }
  .card-body { padding: 14px; }
  .feed-container { padding: 16px 12px 32px; }
  .reader-modal-inner { padding: 0 16px 60px; }
  .reader-sticky-title { max-width: 50vw; font-size: 1em; }
  :root { --panel-width: 340px; }
}
@media (max-width: 400px) {
  .card-img-wrap { height: 130px; min-height: 130px; }
  :root { --panel-width: 92vw; }
  .reader-sticky-title { max-width: 40vw; font-size: 0.95em; }
}

/* Extra styles for new buttons in reader topbar */
.reader-actions .icon-btn {
  width: 38px;
  height: 38px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius-tab);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition);
}

.reader-actions .icon-btn:hover {
  background: var(--bg-card);
  color: var(--text-primary);
  border-color: var(--border-hover);
}

.reader-actions .icon-btn svg {
  width: 18px;
  height: 18px;
}

/* Make sure the sticky title doesn't overlap too much on small screens */
@media (max-width: 680px) {
  .reader-sticky-title {
    font-size: 1em;
    max-width: 38vw;
  }
  .reader-actions {
    gap: 8px;
  }
}

/* ─── READ CHECKBOX ─── */
.card-meta {
    position: relative;
}

.read-checkbox {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.read-checkbox-label {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid var(--text-muted);
    border-radius: 4px;
    background: transparent;
    cursor: pointer;
    position: relative;
    flex-shrink: 0;
    transition: all 0.2s ease;
}

.read-checkbox:checked + .read-checkbox-label {
    background: var(--accent-violet);
    border-color: var(--accent-violet);
}

.read-checkbox:checked + .read-checkbox-label::after {
    content: '✓';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-size: 14px;
    font-weight: bold;
}

.read-checkbox-label:hover {
    border-color: var(--accent-violet);
}

/* Optional: make it a bit more visible on read cards */
.card.read-article .read-checkbox-label {
    border-color: #9ca3af;
}

.card.read-article .read-checkbox:checked + .read-checkbox-label {
    background: #9ca3af;
    border-color: #9ca3af;
}

.meta-author,
.rmeta-author {
    color: var(--text-secondary);
    font-weight: 500;
}

.meta-reading-time,
.rmeta-reading-time {
    color: var(--accent-violet);
    font-weight: 500;
    font-size: 12px;
}

@media (max-width: 680px) {
    .meta-author,
    .rmeta-author,
    .meta-reading-time,
    .rmeta-reading-time {
        font-size: 11px;
    }
}
.meta-reading-time.faint {
    opacity: 0.6;
    font-size: 11px;
}

/* Hide read articles when the mode is active */
body.hide-read .card.read-article {
  display: none;
}

/* Optional: show a message when no unread articles remain */
body.hide-read .feed:empty::before {
  content: "All articles in this tab are read.";
  display: block;
  text-align: center;
  color: var(--text-muted);
  font-size: 16px;
  padding: 60px 20px;
}

body.hide-read .feed:empty::after {
  content: "Toggle the eye icon to show read articles again.";
  display: block;
  text-align: center;
  color: var(--text-secondary);
  font-size: 14px;
  padding: 0 20px 40px;
}

/* Sub-tabs (source filters) */
.sub-tabs-wrap {
  z-index: 89;
  background: rgba(15,15,18,0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  padding: 0 20px;
  border-radius: var(--radius-card);
  margin-bottom: 1rem;
}

.sub-tabs {
  display: flex;
  gap: 12px;
  padding: 12px 0;
  overflow-x: auto;
  white-space: nowrap;
  scrollbar-width: none;
}

.sub-tabs::-webkit-scrollbar {
  display: none;
}

.sub-tab {
  padding: 8px 16px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

.sub-tab:hover {
  background: var(--bg-card);
  color: var(--text-primary);
  border-color: var(--border-hover);
}

.sub-tab.active {
  background: var(--accent-violet);
  color: white;
  border-color: var(--accent-violet);
}