/* ═══════════════════════════════════════
   Hermes Daily — Premium Dark Theme
   Fonts: Satoshi (headings) + Inter (body)
   ═══════════════════════════════════════ */

/* ── Font Loading ── */
@import url('https://api.fontshare.com/v2/css?f[]=satoshi@900,700,500,400&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');
@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;500&display=swap');

/* ── CSS Variables / Theme ── */
:root {
  /* Light Theme */
  --bg: #f8f7f4;
  --bg-secondary: #f0eee8;
  --text: #1a1816;
  --text-secondary: #6b6560;
  --text-tertiary: #9e9790;
  --card-bg: #ffffff;
  --card-border: #e5e0d8;
  --card-shadow: 0 1px 3px rgba(0,0,0,0.04), 0 4px 12px rgba(0,0,0,0.03);
  --card-shadow-hover: 0 4px 16px rgba(0,0,0,0.06), 0 8px 24px rgba(0,0,0,0.04);
  --accent: #b8860b;
  --accent-light: #d4a843;
  --accent-dark: #8b6508;
  --accent-glow: rgba(184, 134, 11, 0.15);
  --header-bg: #1a1512;
  --header-text: #e8e3dd;
  --header-border: rgba(255,255,255,0.06);
  --nav-inactive: #8a8580;
  --nav-hover-bg: rgba(255,255,255,0.06);
  --tag-bg: #eeeae4;
  --tag-text: #6b6560;
  --tag-border: #ddd8d0;
  --footer-bg: #1a1512;
  --footer-text: #6b6560;
  --footer-link: #b8860b;
  --badge-hn: #f97316;
  --badge-github: #6e40c9;
  --badge-reddit: #ff4500;
  --badge-techmeme: #4b5563;
  --badge-arstechnica: #c1121f;
  --badge-producthunt: #3b82f6;
  --badge-rss: #e85c33;
  --toast-bg: #b8860b;
  --score-high: #22c55e;
  --score-mid: #eab308;
  --separator: #e5e0d8;
}

/* ── Dark Theme ── */
body.dark-mode {
  --bg: #0d0d0d;
  --bg-secondary: #141414;
  --text: #e8e3dd;
  --text-secondary: #8a8580;
  --text-tertiary: #5a5550;
  --card-bg: #1a1816;
  --card-border: #2a2622;
  --card-shadow: 0 1px 3px rgba(0,0,0,0.3), 0 4px 12px rgba(0,0,0,0.2);
  --card-shadow-hover: 0 4px 20px rgba(0,0,0,0.4), 0 8px 32px rgba(0,0,0,0.3);
  --accent: #d4a843;
  --accent-light: #e8c86a;
  --accent-dark: #b8860b;
  --accent-glow: rgba(212, 168, 67, 0.08);
  --header-bg: #080808;
  --header-text: #e8e3dd;
  --header-border: rgba(255,255,255,0.04);
  --nav-inactive: #5a5550;
  --nav-hover-bg: rgba(255,255,255,0.04);
  --tag-bg: #2a2622;
  --tag-text: #8a8580;
  --tag-border: #3a3530;
  --footer-bg: #080808;
  --footer-text: #5a5550;
  --footer-link: #d4a843;
  --toast-bg: #d4a843;
  --separator: #2a2622;
}

/* ── Reset ── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  font-size: 16px;
  line-height: 1.7;
  background-color: var(--bg);
  color: var(--text);
  transition: background-color 0.35s ease, color 0.35s ease;
  min-height: 100vh;
}

/* ── Typography ── */
h1, h2, h3, h4 {
  font-family: 'Satoshi', 'Inter', system-ui, sans-serif;
  font-weight: 700;
  letter-spacing: -0.025em;
  line-height: 1.25;
}

h1 { font-size: 1.5rem; }
h2 { font-size: 1.35rem; }
h3 { font-size: 1.1rem; }

a {
  color: var(--accent);
  text-decoration: none;
  transition: color 0.2s;
}

a:hover {
  color: var(--accent-light);
}

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: var(--card-border);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--text-tertiary);
}

/* ═══════════════════════════════════════
   HEADER
   ═══════════════════════════════════════ */

header {
  background: var(--header-bg);
  color: var(--header-text);
  padding: 0;
  position: sticky;
  top: 0;
  z-index: 100;
  border-bottom: 1px solid var(--header-border);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.header-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 14px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

/* Logo */
.logo-area {
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}

.logo-area h1 {
  font-size: 1.35rem;
  color: var(--accent);
  margin: 0;
  letter-spacing: -0.03em;
}

.tagline {
  font-size: 0.7rem;
  color: var(--nav-inactive);
  margin: 0;
  font-weight: 400;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  font-family: 'Inter', sans-serif;
}

/* Navigation */
.nav-links {
  display: flex;
  gap: 4px;
  background: rgba(255,255,255,0.04);
  padding: 3px;
  border-radius: 10px;
}

.nav-link {
  color: var(--nav-inactive);
  text-decoration: none;
  font-size: 0.82rem;
  font-weight: 500;
  padding: 6px 14px;
  border-radius: 8px;
  transition: all 0.2s;
  letter-spacing: 0.01em;
}

.nav-link:hover {
  color: var(--header-text);
  background: var(--nav-hover-bg);
}

.nav-link.active {
  color: var(--accent);
  background: rgba(212, 168, 67, 0.12);
}

/* Theme Toggle */
.theme-toggle label {
  cursor: pointer;
  font-size: 0.82rem;
  color: var(--nav-inactive);
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 8px;
  transition: all 0.2s;
  user-select: none;
}

.theme-toggle label:hover {
  color: var(--header-text);
  background: var(--nav-hover-bg);
}

.theme-toggle input[type="checkbox"] {
  accent-color: var(--accent);
  width: 16px;
  height: 16px;
  cursor: pointer;
}

/* ═══════════════════════════════════════
   HERO / TIMESTAMP
   ═══════════════════════════════════════ */

.hero {
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px 24px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}

.timestamp {
  font-size: 0.78rem;
  color: var(--text-tertiary);
  font-weight: 400;
}

/* ═══════════════════════════════════════
   FILTER BUTTONS
   ═══════════════════════════════════════ */

.filter-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 12px 24px 4px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.filter-btn {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  color: var(--text-secondary);
  padding: 5px 13px;
  border-radius: 20px;
  cursor: pointer;
  font-size: 0.78rem;
  font-weight: 500;
  transition: all 0.2s ease;
  font-family: 'Inter', sans-serif;
  box-shadow: var(--card-shadow);
}

.filter-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
  transform: translateY(-1px);
  box-shadow: 0 2px 8px var(--accent-glow);
}

.filter-btn.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
  box-shadow: 0 2px 12px var(--accent-glow);
}

/* ═══════════════════════════════════════
   TAG BAR
   ═══════════════════════════════════════ */

#tag-filter-bar {
  max-width: 1200px;
  margin: 0 auto;
  padding: 2px 24px 8px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.tag {
  background: var(--tag-bg);
  border: 1px solid var(--tag-border);
  color: var(--tag-text);
  font-size: 0.65rem;
  padding: 2px 10px;
  border-radius: 999px;
  font-weight: 600;
  text-transform: uppercase;
  cursor: pointer;
  transition: all 0.2s;
  letter-spacing: 0.04em;
  user-select: none;
}

.tag:hover {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.tag.active-tag {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  box-shadow: 0 0 0 2px var(--accent-glow);
}

#active-tag-label {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px 8px;
  font-size: 0.78rem;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 8px;
}

#clear-tag-filter {
  background: none;
  border: none;
  color: var(--accent);
  cursor: pointer;
  font-size: 1rem;
  padding: 0 4px;
  opacity: 0.7;
  transition: opacity 0.2s;
}

#clear-tag-filter:hover {
  opacity: 1;
}

/* ═══════════════════════════════════════
   NEWS GRID
   ═══════════════════════════════════════ */

main {
  max-width: 1200px;
  margin: 0 auto;
  padding: 8px 24px 32px;
}

#news-container {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
  gap: 16px;
}

/* ═══════════════════════════════════════
   ARTICLE CARDS — BEAUTIFUL
   ═══════════════════════════════════════ */

article {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 12px;
  padding: 20px 22px;
  box-shadow: var(--card-shadow);
  transition: all 0.25s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
}

/* Article hero image */
.article-hero {
  margin: -20px -22px 16px;
  height: 140px;
  overflow: hidden;
  background: var(--bg);
  border-radius: 12px 12px 0 0;
}

.article-hero img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.4s ease;
}

article:hover .article-hero img {
  transform: scale(1.03);
}

/* Gold accent bar */
article::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--accent), var(--accent-light), var(--accent));
  opacity: 0.6;
  transition: opacity 0.3s;
}

article:hover::before {
  opacity: 1;
}

article:hover {
  transform: translateY(-4px);
  box-shadow: var(--card-shadow-hover);
  border-color: var(--accent);
}

/* Score badge */
.score-badge {
  position: absolute;
  top: 14px;
  right: 14px;
  font-size: 0.65rem;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 6px;
  font-family: 'JetBrains Mono', monospace;
  letter-spacing: 0;
}

/* Source-based accent for articles without hero image */
article:not(:has(.article-hero)) {
  border-left: 3px solid transparent;
}
article:not(:has(.article-hero))::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  width: 3px;
  opacity: 0.5;
}

/* Decorative gradient dot for articles with no image */
article:not(:has(.article-hero)) .tags ~ h2 {
  padding-top: 6px;
}

.score-high { background: rgba(34, 197, 94, 0.12); color: var(--score-high); }
.score-mid { background: rgba(234, 179, 8, 0.12); color: var(--score-mid); }

/* Article tags */
article .tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-bottom: 10px;
}

article .tag {
  font-size: 0.6rem;
  padding: 2px 8px;
}

/* Title */
article h2 {
  font-size: 1.05rem;
  margin: 0 0 8px;
  line-height: 1.35;
}

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

article h2 a:hover {
  color: var(--accent);
}

/* Summary */
article p {
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.6;
  margin: 0 0 auto;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ═══════════════════════════════════════
   CARD FOOTER
   ═══════════════════════════════════════ */

.card-footer {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--separator);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}

.source-badge {
  display: inline-block;
  padding: 2px 10px;
  font-size: 0.65rem;
  font-weight: 600;
  border-radius: 6px;
  color: #fff;
}

.badge-hacker-news { background: var(--badge-hn); }
.badge-github { background: var(--badge-github); }
.badge-reddit { background: var(--badge-reddit); }
.badge-techmeme { background: var(--badge-techmeme); }
.badge-ars-technica { background: var(--badge-arstechnica); }
.badge-product-hunt { background: var(--badge-producthunt); }
.badge-rss { background: var(--badge-rss); }

.info-time {
  font-size: 0.7rem;
  color: var(--text-tertiary);
  font-weight: 400;
}

.save-btn {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  color: var(--text-secondary);
  padding: 4px 12px;
  border-radius: 6px;
  font-size: 0.72rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  font-family: 'Inter', sans-serif;
  flex-shrink: 0;
}

.save-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-glow);
}

/* ═══════════════════════════════════════
   SAVED ARTICLES SECTION
   ═══════════════════════════════════════ */

#saved-articles {
  max-width: 1200px;
  margin: 40px auto;
  padding: 28px;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 14px;
  box-shadow: var(--card-shadow);
}

#saved-articles h2 {
  text-align: center;
  margin: 0 0 4px;
}

#toggle-saved {
  background: none;
  border: none;
  color: var(--accent);
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  font-family: 'Satoshi', sans-serif;
  padding: 8px 16px;
  border-radius: 8px;
  transition: background 0.2s;
}

#toggle-saved:hover {
  background: var(--accent-glow);
}

#saved-container.collapsed { display: none; }

.saved-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
  margin-top: 18px;
}

#clear-saved,
#export-saved {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  color: var(--text-secondary);
  padding: 6px 16px;
  border-radius: 8px;
  font-size: 0.78rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  font-family: 'Inter', sans-serif;
}

#clear-saved:hover,
#export-saved:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.remove-btn {
  background: var(--card-bg);
  border: 1px solid var(--separator);
  color: var(--text-tertiary);
  padding: 4px 12px;
  border-radius: 6px;
  font-size: 0.72rem;
  cursor: pointer;
  transition: all 0.2s;
  font-family: 'Inter', sans-serif;
}

.remove-btn:hover {
  border-color: #ef4444;
  color: #ef4444;
}

/* ═══════════════════════════════════════
   MONEY-MAKING PROJECTS
   ═══════════════════════════════════════ */

.featured-section {
  max-width: 1200px;
  margin: 40px auto;
  padding: 28px;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 14px;
  box-shadow: var(--card-shadow);
  position: relative;
  overflow: hidden;
}

.featured-section::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--accent), #22c55e, var(--accent));
  opacity: 0.5;
}

.featured-section h2 {
  font-size: 1.35rem;
  color: var(--accent);
  margin: 0 0 4px;
}

.section-desc {
  font-size: 0.82rem;
  color: var(--text-secondary);
  margin: 0 0 20px;
}

.tech-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 14px;
}

.project-card {
  background: var(--bg);
  border: 1px solid var(--card-border);
  border-radius: 10px;
  padding: 18px 20px;
  transition: all 0.2s;
  position: relative;
}

.project-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--card-shadow-hover);
  border-color: var(--accent);
}

.project-card h3 {
  font-size: 0.95rem;
  margin: 0 0 6px;
}

.project-card h3 a {
  color: var(--text);
}

.project-card h3 a:hover {
  color: var(--accent);
}

.project-meta {
  font-size: 0.72rem;
  color: var(--text-tertiary);
  margin-bottom: 8px;
}

.project-meta .stars {
  color: var(--accent);
  font-weight: 600;
}

.project-card p {
  font-size: 0.82rem;
  color: var(--text-secondary);
  line-height: 1.55;
  margin: 0 0 10px;
}

.project-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-bottom: 10px;
}

.project-tags span {
  background: var(--tag-bg);
  border: 1px solid var(--tag-border);
  color: var(--tag-text);
  font-size: 0.6rem;
  padding: 2px 8px;
  border-radius: 999px;
  font-weight: 600;
}

.project-link {
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

/* ═══════════════════════════════════════
   FOOTER
   ═══════════════════════════════════════ */

footer {
  background: var(--footer-bg);
  color: var(--footer-text);
  padding: 28px 24px;
  margin-top: 48px;
  border-top: 1px solid var(--header-border);
}

.footer-inner {
  max-width: 1200px;
  margin: 0 auto;
  text-align: center;
  font-size: 0.78rem;
}

.footer-links {
  margin-top: 8px;
  display: flex;
  gap: 16px;
  justify-content: center;
}

.footer-links a {
  color: var(--footer-link);
  font-size: 0.78rem;
}

.footer-links a:hover {
  text-decoration: underline;
}

/* ═══════════════════════════════════════
   TOAST NOTIFICATION
   ═══════════════════════════════════════ */

.toast {
  position: fixed;
  bottom: 28px;
  right: 28px;
  background: var(--toast-bg);
  color: #fff;
  padding: 10px 20px;
  border-radius: 10px;
  font-size: 0.82rem;
  font-weight: 500;
  box-shadow: 0 4px 24px rgba(0,0,0,0.3);
  z-index: 9999;
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 0.3s ease, transform 0.3s ease;
  pointer-events: none;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

/* ═══════════════════════════════════════
   RESPONSIVE
   ═══════════════════════════════════════ */

@media (max-width: 900px) {
  .header-inner {
    flex-wrap: wrap;
    justify-content: center;
    gap: 12px;
  }

  .logo-area {
    text-align: center;
    width: 100%;
  }

  .nav-links {
    order: 10;
    width: 100%;
    justify-content: center;
  }

  #news-container {
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  }

  .tech-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 600px) {
  .header-inner {
    padding: 12px 16px;
  }

  main { padding: 4px 16px 24px; }
  .filter-container { padding: 8px 16px 2px; }
  #tag-filter-bar { padding: 0 16px 6px; }

  #news-container {
    grid-template-columns: 1fr;
  }

  article { padding: 16px 18px; }

  .featured-section { margin: 24px 12px; }
}

/* ═══════════════════════════════════════
   LOADING STATE
   ═══════════════════════════════════════ */

.loading-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-tertiary);
}

.loading-state .spinner {
  display: inline-block;
  width: 32px;
  height: 32px;
  border: 3px solid var(--card-border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin-bottom: 12px;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.empty-state {
  text-align: center;
  padding: 80px 20px;
  color: var(--text-tertiary);
}

.empty-state .icon {
  font-size: 3rem;
  margin-bottom: 12px;
}
