/* Global Body Styles */
body {
  font-family: 'IBM Plex Sans', system-ui, sans-serif;
  font-size: 17px;
  line-height: 1.75;
  margin: 0;
  padding: 0;
  background-color: var(--bg);
  color: var(--text);
}

/* ── Metadata Reset ── */
/* Ensure info-source & info-time never get a background,
   and remove default paragraph top‐margin in Focus Mode */
.info-source,
.info-time {
  background-color: transparent !important;
}
body.focus-mode article p {
  margin: 0 !important;
}

header, footer {
  background-color: var(--header-bg);
  color: var(--header-text);
  text-align: center;
  padding: 20px;
}

main {
  padding: 20px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 20px;
}

/* Article Cards */
article {
  background-color: var(--card);
  padding: 20px;
  border-left: 6px solid var(--accent);
  border-radius: 12px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

article:hover {
  transform: translateY(-3px);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.12);
}

article h2 {
  font-size: 1.1rem;
  margin-bottom: 6px;
}

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

article a:hover {
  text-decoration: underline;
}

article p {
  font-size: 0.92rem;
  line-height: 1.5;
  color: var(--text);
  margin: 8px 0 0;
}

/* Timestamp + Refresh Button */
.timestamp {
  font-size: 0.85em;
  color: #777;
  margin: 10px 0 0;
}

.refresh-container {
  text-align: center;
  margin: 20px 0;
}

#refresh-btn {
  padding: 10px 18px;
  font-size: 1rem;
  background-color: var(--accent);
  color: white;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  font-weight: 500;
  transition: background-color 0.3s ease, transform 0.2s ease;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

#refresh-btn:hover {
  background-color: #005fa3;
  transform: translateY(-1px);
}

/* Saved Articles */
#saved-articles {
  padding: 24px;
  margin-top: 40px;
  background-color: var(--card);
  border-top: 2px solid #ddd;
  max-width: 960px;
  margin-left: auto;
  margin-right: auto;
  border-radius: 12px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

#saved-articles h2 {
  margin-top: 0;
  font-size: 1.6rem;
  text-align: center;
  display: block;
}

#saved-container article {
  background-color: var(--card);
  border-radius: 8px;
  border-left: 4px solid var(--accent);
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
  padding: 12px 16px;
  margin-bottom: 16px;
}

#saved-container article h3 {
  font-size: 1rem;
  margin: 0 0 6px;
}

#saved-container article p {
  font-size: 0.85rem;
  margin: 0;
}

/* Collapsible logic */
#saved-container.collapsed {
  display: none;
}

#toggle-saved {
  background: none;
  border: none;
  color: var(--accent);
  font-size: 0.95rem;
  font-weight: bold;
  cursor: pointer;
  margin-left: 12px;
}

#toggle-saved:hover {
  text-decoration: underline;
}

/* Featured Tech Picks Section */
#featured-tech {
  padding: 20px;
  max-width: 1200px;
  margin: 60px auto;
  background-color: var(--card);
  border-top: 2px solid #ddd;
  box-sizing: border-box;
}

#featured-tech h2 {
  font-size: 1.6rem;
  margin-bottom: 24px;
  padding-left: 6px;
}

/* Grid Layout */
.tech-grid {
  display: grid;
  gap: 20px;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
}

/* Tech Product Card */
.tech-card {
  background-color: var(--card);
  border-radius: 12px;
  padding: 20px;
  border-left: 5px solid var(--accent);
  box-shadow: 0 3px 10px rgba(0,0,0,0.07);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.tech-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.12);
}

.tech-card h3 {
  margin-top: 0;
  font-size: 1.15rem;
}

.tech-card p {
  font-size: 0.9rem;
  color: var(--text);
  margin: 10px 0;
}

.tech-card .rating {
  font-size: 1rem;
  color: #f5c518;
  margin: 6px 0 10px;
}

.tech-card a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.tech-card a:hover {
  text-decoration: underline;
}

.variant-links {
  list-style: none;
  padding-left: 0;
  margin-top: 8px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.variant-links li a {
  font-size: 0.85rem;
  font-weight: 500;
  text-decoration: none;
  color: var(--accent);
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

/* Icons */
.icon {
  width: 16px;
  height: 16px;
  vertical-align: middle;
}

/* Ad Placeholder */
#ad-spot {
  padding: 24px;
  background-color: var(--card);
  text-align: center;
  margin-top: 40px;
  border-top: 2px dashed #bbb;
  font-size: 0.95rem;
  color: #666;
  max-width: 960px;
  margin-left: auto;
  margin-right: auto;
}

/* Light Theme */
:root {
  --bg: #f9f9f9;
  --text: #222;
  --card: #fff;
  --accent: #0077cc;
  --header-bg: #1a1a1a;
  --header-text: #fff;
}

/* Dark Theme */
body.dark-mode {
  --bg: #1e1e1e;
  --text: #eee;
  --card: #2a2a2a;
  --accent: #4ea1ff;
  --header-bg: #111;
  --header-text: #eee;
}

.theme-toggle {
  margin-top: 10px;
}

/* 🧠 Sponsored Section Styling */
#ad-section {
  background-color: var(--card);
  color: var(--text);
  padding: 24px;
  margin-top: 40px;
  border-top: 2px dashed #bbb;
  text-align: center;
  max-width: 960px;
  margin-left: auto;
  margin-right: auto;
}

#ad-section h2 {
  font-size: 1.4rem;
  margin-top: 0;
  margin-bottom: 10px;
}

#ad-section .ad-box {
  font-size: 1rem;
  color: var(--text);
}

/* Buy Me a Coffee */
.bmc-container {
  margin-top: 10px;
}

.bmc-container a {
  background-color: #ffdd00;
  color: #000;
  text-decoration: none;
  padding: 10px 16px;
  border-radius: 8px;
  font-weight: 600;
  display: inline-block;
  transition: background-color 0.3s ease;
}

.bmc-container a:hover {
  background-color: #f5c400;
}

.disclaimer {
  font-size: 0.8rem;
  color: #888;
  text-align: center;
  margin-top: 40px;
  padding-bottom: 10px;
}

/* 🔍 Filter Buttons */
.filter-container {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  margin: 20px 0;
}

.filter-container button {
  background-color: var(--card);
  border: 2px solid var(--accent);
  color: var(--accent);
  padding: 8px 14px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.95rem;
  font-weight: 500;
  transition: all 0.2s ease;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
}

.filter-container button:hover {
  background-color: var(--accent);
  color: var(--card);
  transform: translateY(-1px);
}

/* ── Read Later Button Styling ── */
.save-btn {
  display: inline-block;
  background-color: var(--card);
  border: 2px solid var(--accent);
  color: var(--accent);
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: background-color 0.2s ease, color 0.2s ease, transform 0.1s ease;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
  margin-top: 8px; /* give it a little breathing room */
}

.save-btn:hover {
  background-color: var(--accent);
  color: var(--card);
  transform: translateY(-1px);
}

/* ── Saved Articles Button Styling ── */
#clear-saved,
#export-saved {
  background-color: var(--card);
  border: 2px solid var(--accent);
  color: var(--accent);
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: background-color 0.2s ease, color 0.2s ease, transform 0.1s ease;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
  margin-right: 10px; /* space between the two buttons */
}

#clear-saved:hover,
#export-saved:hover {
  background-color: var(--accent);
  color: var(--card);
  transform: translateY(-1px);
}

/* Optionally tighten up the Saved Articles header spacing */
#saved-articles h2 {
  margin-bottom: 12px;
}

/* 🎨 Source Badges */
.source-badge {
  display: inline-block;
  padding: 4px 8px;
  font-size: 0.75rem;
  font-weight: 600;
  color: #fff;
  border-radius: 6px;
  margin-top: 8px;
  margin-bottom: 4px;
  width: fit-content;
}

/* Only badges themselves get the background */
.source-badge.source-techmeme {
  background-color: #4b5563;
}
.source-badge.source-arstechnica {
  background-color: #c1121f;
}
.source-badge.source-hackernews {
  background-color: #f97316;
}
.source-badge.source-producthunt {
  background-color: #3b82f6;
}

/* 🎨 Source-specific filter button colors */
.filter-container button.source-techmeme {
  border-color: #4b5563;
  color: #4b5563;
}

.filter-container button.source-techmeme:hover {
  background-color: #4b5563;
  color: #fff;
}

.filter-container button.source-arstechnica {
  border-color: #c1121f;
  color: #c1121f;
}
.filter-container button.source-arstechnica:hover {
  background-color: #c1121f;
  color: #fff;
}

.filter-container button.source-hackernews {
  border-color: #f97316;
  color: #f97316;
}
.filter-container button.source-hackernews:hover {
  background-color: #f97316;
  color: #fff;
}

.filter-container button.source-producthunt {
  border-color: #3b82f6;
  color: #3b82f6;
}
.filter-container button.source-producthunt:hover {
  background-color: #3b82f6;
  color: #fff;
}

/* ── Focus Mode: Minimal List with Adjusted Spacing ── */
body.focus-mode main {
  display: block !important;
}

body.focus-mode article {
  display: flex !important;
  flex-direction: column !important;
  background: transparent !important;
  box-shadow: none !important;
  border-left: none !important;
  padding: 4px 16px !important;
  margin: 0 0 16px !important;    /* 16px below each block */
}

body.focus-mode h2 {
  margin: 0 0 2px !important;      /* 2px below headline */
  font-size: 1rem !important;
}

body.focus-mode h2 a {
  color: var(--accent) !important;
  text-decoration: none !important;
}

body.focus-mode .info-source {
  display: block !important;
  font-weight: 500 !important;
  margin: 0 0 2px !important;      /* 2px below source */
}

body.focus-mode .info-time {
  display: block !important;
  font-weight: 300 !important;
  color: #666 !important;
  margin: 0 0 0 !important;        /* no extra bottom margin */
}

/* Apply source-specific text colors */
body.focus-mode p.source-techmeme .info-source {
  color: #4b5563 !important;
}
body.focus-mode p.source-arstechnica .info-source {
  color: #c1121f !important;
}
body.focus-mode p.source-hackernews .info-source {
  color: #f97316 !important;
}
body.focus-mode p.source-producthunt .info-source {
  color: #3b82f6 !important;
}

/* Hide the badges & Read Later buttons */
body.focus-mode .source-badge,
body.focus-mode .save-btn {
  font-size: 0.85rem;
  padding: 2px 8px;
  margin-top: 4px;
  border-radius: 6px;
  background-color: var(--card);
  border: 1px solid var(--accent);
  color: var(--accent);
  cursor: pointer;
}

/* ── Hide the source text in regular mode (badge already shows it) ── */
.info-source {
  display: none;
}

/* ── In Focus Mode, reveal the source line ── */
body.focus-mode .info-source {
  display: block !important;
}

/* ── Card Layout Consistency ── */
article {
  display: flex;
  flex-direction: column;
}

.card-footer {
  margin-top: auto;     /* pushes this section to the bottom of the card */
  display: flex;
  flex-direction: column;
  gap: 6px;             /* small gap between badge, info, and button */
}

#jump-to-saved-btn {
  padding: 10px 18px;
  font-size: 0.95rem;
  background-color: var(--accent);
  color: #fff;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 500;
  transition: background-color 0.3s ease;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
}

#jump-to-saved-btn:hover {
  background-color: #005fa3;
}

/* Shorter '⭐ Save' style in Focus Mode */
body.focus-mode .save-btn {
  font-size: 0.8rem;
  padding: 4px 10px;
  width: fit-content;
  max-width: 100%;
  white-space: nowrap;
  margin-top: 6px;
  align-self: flex-start;
}

.remove-btn {
  background-color: transparent;
  border: 1px solid var(--accent);
  color: var(--accent);
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 0.85rem;
  cursor: pointer;
  margin-top: 8px;
  transition: background-color 0.2s ease, color 0.2s ease;
}

.remove-btn:hover {
  background-color: var(--accent);
  color: var(--card);
}

/* Ensure saved article cards are styled like regular cards */
.saved-article {
  background-color: var(--card);
  border-radius: 8px;
  border-left: 4px solid var(--accent);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  padding: 12px 16px;
  margin-bottom: 16px;
}

/* Reuse existing layout */
.saved-article .card-footer {
  margin-top: 10px;
  display: flex;
  justify-content: flex-start !important; /* Force left alignment */
  flex-direction: row !important;
  padding-left: 0;
}

/* Match remove button to save/clear styles */
.remove-btn {
  margin-left: 0 !important;
  background-color: var(--card);
  border: 1px solid var(--accent);
  color: var(--accent);
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: background-color 0.2s ease, color 0.2s ease, transform 0.1s ease;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
}

.remove-btn:hover {
  background-color: var(--accent);
  color: var(--card);
  transform: translateY(-1px);
}

#saved-container .remove-btn {
  background-color: var(--card);
  border: 1px solid var(--accent);
  color: var(--accent);
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: background-color 0.2s ease, color 0.2s ease, transform 0.1s ease;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
  width: fit-content;
  align-self: flex-start;
}

#saved-container .remove-btn:hover {
  background-color: var(--accent);
  color: var(--card);
  transform: translateY(-1px);
}

/* ── Saved Articles: Text‐only Source Colors ── */
.saved-article strong {
  font-weight: 600;
}

.saved-article[data-source="Ars Technica"] strong {
  color: #E31B23;  /* red */
}

.saved-article[data-source="Techmeme"] strong {
  color: #4272A3;  /* blue */
}

.saved-article[data-source="Hacker News"] strong {
  color: #FF6600;  /* orange */
}

.saved-article[data-source="Product Hunt"] strong {
  color: #DA552F;  /* red */
}

.featured-section {
  background-color: var(--bg);
  padding: 2rem 1rem;
  margin-top: 2rem;
}

.featured-section .tech-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1.5rem;
}

body.blog .header-link {
  color: #00bcd4;
  text-decoration: none;
  font-weight: 500;
  font-size: 1rem;
}

.header-link:hover {
  text-decoration: underline;
}

/* Blog Theme using IBM Plex Sans */
body.blog {
  font-family: 'IBM Plex Sans', system-ui, sans-serif;
  color: #111;
  background-color: #fff;
  line-height: 1.75;
  font-size: 17px;
}

body.blog main {
  max-width: 700px;
  margin: 0 auto;
  padding: 2rem;
}

h1, h2, h3 {
  font-weight: 600;
  line-height: 1.3;
  margin-top: 2rem;
  margin-bottom: 1rem;
}

h1 {
  font-size: 2.2rem;
}

h2 {
  font-size: 1.75rem;
}

h3 {
  font-size: 1.4rem;
}

p {
  margin-bottom: 1.25rem;
}

a {
  color: #0077cc;
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

header {
  background-color: #111;
  color: #fff;
  text-align: center;
  padding: 1rem;
}

.header-link {
  color: #fff;
  font-weight: 500;
  font-size: 1rem;
}

footer {
  text-align: center;
  color: #777;
  padding: 2rem 0;
  font-size: 0.9rem;
}

.tags {
  margin-top: 0.5rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.tag {
  background-color: #eee;
  color: #333;
  font-size: 0.75rem;
  padding: 4px 10px;
  border-radius: 999px;
  font-weight: 500;
  text-transform: uppercase;
  cursor: pointer;
  transition: background-color 0.2s ease, color 0.2s ease;
}

.tag:hover {
  background-color: #ddd;
}

.tag.active-tag {
  background-color: var(--accent);
  color: #fff;
  border: 2px solid var(--accent);
  font-weight: 600;
}

.dark-mode .tag {
  background-color: #222;
  color: #ddd;
}

.dark-mode .tag:hover {
  background-color: #333;
}

#saved-container .tags {
  margin-top: 8px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

#saved-container .tag {
  background-color: #ddd;
  color: #333;
  padding: 4px 10px;
  font-size: 0.75rem;
  border-radius: 999px;
  font-weight: 500;
  text-transform: uppercase;
}
body.dark-mode #saved-container .tag {
  background-color: #222;
  color: #ddd;
} 

/* 🔖 Tag Filter Bar – Final Alignment Fix */
#tag-filter-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin: 20px auto 12px;
  max-width: 960px;
}

#tag-filter-bar .tag {
  cursor: pointer;
  background-color: #eee;
  color: #333;
  font-size: 0.75rem;
  padding: 4px 10px;
  border-radius: 999px;
  font-weight: 500;
  text-transform: uppercase;
  transition: background-color 0.2s ease;
}

body.dark-mode #tag-filter-bar .tag {
  background-color: #222;
  color: #ddd;
}

#tag-filter-bar .active-tag {
  background-color: var(--accent);
  color: #fff;
  border: 2px solid var(--accent);
}

.tag-clear-wrapper {
  display: flex;
}

#clear-tag-filter {
  background: none;
  border: none;
  font-size: 1rem;
  color: var(--accent);
  cursor: pointer;
  padding: 2px 6px;
  line-height: 1;
  font-weight: bold;
}

#clear-tag-filter:hover {
  color: #ff4d4d;
}

#active-tag-label {
  text-align: center;
  margin: 12px auto 24px;
  font-size: 1rem;
  font-style: italic;
  font-weight: 500;
  color: #444;
  max-width: 960px;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
}

.tag-bar-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 10px;
}
