:root {
  --bg: #0a0a0c;
  --surface: #121216;
  --text: #f3f4f6;
  --muted: #9ca3af;
  --accent: #ff4655;
  --tag-bg: #1f222b;
  --border: #27273a;
  --font-brand: 'Orbitron', sans-serif;
  --font-serif: 'Roboto', sans-serif;
  --font-ui: 'Inter', sans-serif;
  --max-width: 720px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 18px; scroll-behavior: smooth; }
body { background: var(--bg); color: var(--text); font-family: var(--font-serif); line-height: 1.75; }

/* Header */
.sticky-header { position: sticky; top: 0; z-index: 100; }
.site-header { background: var(--surface); border-bottom: 1px solid var(--border); }

/* Brand */
.site-brand { max-width: 1100px; margin: 0 auto; padding: 0.9rem 2rem 0.7rem; display: flex; flex-direction: column; gap: 0.1rem; }
.brand-name { font-family: var(--font-brand); font-size: 2rem; font-weight: 900; color: #ffffff; text-decoration: none; letter-spacing: -0.03em; line-height: 1; }
.brand-name:hover { color: var(--accent); }
.brand-tagline { font-family: var(--font-ui); font-size: 0.78rem; color: var(--muted); font-weight: 400; letter-spacing: 0.01em; }

/* Ticker */
.ticker-outer { overflow: hidden; border-top: 1px solid var(--border); background: var(--surface); height: 40px; user-select: none; }
.ticker-belt { display: flex; width: max-content; height: 40px; will-change: transform; }
.ticker-set { display: flex; align-items: center; height: 40px; }
.ti { display: inline-flex; align-items: center; gap: 0.35rem; padding: 0 1.1rem; font-size: 0.72rem; font-family: var(--font-brand); white-space: nowrap; }
.ts { font-weight: 700; color: var(--text); }
.tp { color: #aaa; }
.tc { font-size: 0.7rem; }
.tc.up { color: #16a34a; }
.tc.dn { color: #dc2626; }
.tsep { color: #374151; font-size: 0.6rem; padding: 0 0.1rem; }
.ticker-belt { animation: ticker-scroll 45s linear infinite; }
@keyframes ticker-scroll { from { transform: translateX(0); } to { transform: translateX(-50%); } }

/* Home */
.site-main { min-height: 80vh; }
.home { max-width: 1100px; margin: 0 auto; padding: 2.5rem 2rem; }

.posts-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 2rem; }
.post-card { background: var(--surface); border-radius: 8px; overflow: hidden; border: 1px solid var(--border); transition: box-shadow 0.2s, transform 0.2s; }
.post-card:hover { box-shadow: 0 8px 30px rgba(0,0,0,0.5); transform: translateY(-2px); }
.card-image-link img { width: 100%; height: 200px; object-fit: cover; display: block; }
.card-body { padding: 1.5rem; }
.card-body h2 { font-size: 1.15rem; margin: 0.5rem 0; line-height: 1.4; }
.card-body h2 a { color: var(--text); text-decoration: none; }
.card-body h2 a:hover { color: var(--accent); }
.card-description { font-size: 0.9rem; color: var(--muted); margin-bottom: 0.75rem; }
.card-body time { font-family: var(--font-ui); font-size: 0.8rem; color: var(--muted); }

/* Tags */
.tags { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-bottom: 0.75rem; }
.tag { background: var(--tag-bg); color: var(--accent); font-family: var(--font-ui); font-size: 0.72rem; font-weight: 600; padding: 0.2rem 0.6rem; border-radius: 4px; text-transform: uppercase; letter-spacing: 0.05em; text-decoration: none; display: inline-block; }
.tag:hover { background: var(--accent); color: #ffffff; }

/* Article */
.article { padding-bottom: 4rem; }
.article-hero img { width: 100%; max-height: 480px; object-fit: cover; display: block; }
.image-credit { font-family: var(--font-ui); font-size: 0.75rem; color: var(--muted); text-align: center; margin-top: 0.5rem; }
.article-container { max-width: var(--max-width); margin: 0 auto; padding: 2.5rem 1.5rem; }
.article-title { font-size: 2.2rem; line-height: 1.25; letter-spacing: -0.02em; margin: 1rem 0 0.75rem; font-family: var(--font-brand); }
.article-date { font-family: var(--font-ui); font-size: 0.85rem; color: var(--muted); display: block; margin-bottom: 2rem; }
.article-body { font-size: 1.05rem; line-height: 1.8; }
.article-body h2 { font-size: 1.5rem; margin: 2rem 0 0.75rem; font-family: var(--font-brand); color: var(--accent); }
.article-body h3 { font-size: 1.2rem; margin: 1.5rem 0 0.5rem; font-family: var(--font-brand); }
.article-body p { margin-bottom: 1.5rem; }
.article-body a { color: var(--accent); text-decoration: none; border-bottom: 1px solid transparent; }
.article-body a:hover { border-bottom-color: var(--accent); }
.article-body blockquote { border-left: 4px solid var(--accent); padding-left: 1.25rem; margin: 1.5rem 0; color: var(--muted); font-style: italic; background: var(--tag-bg); padding: 1rem; border-radius: 0 8px 8px 0; }

/* Pagination */
.pagination { display: flex; justify-content: center; align-items: center; gap: 1.5rem; margin-top: 3rem; font-family: var(--font-ui); font-size: 0.9rem; }
.page-link { color: var(--accent); text-decoration: none; font-weight: 600; }
.page-link:hover { text-decoration: underline; }
.page-info { color: var(--muted); }

/* Footer */
.site-footer { text-align: center; padding: 2rem; border-top: 1px solid var(--border); font-family: var(--font-ui); font-size: 0.85rem; color: var(--muted); background: var(--surface); }

/* Mobile */
@media (max-width: 640px) {
  html { font-size: 16px; }
  .home { padding: 1.5rem 1rem; }
  .brand-name { font-size: 1.6rem; }
  .article-title { font-size: 1.6rem; }
  .posts-grid { grid-template-columns: 1fr; }
  .site-brand { padding: 0.75rem 1rem 0.6rem; }
}

/* Share buttons */
.share-section { display: flex; align-items: center; gap: 1rem; margin-top: 3rem; padding-top: 2rem; border-top: 1px solid var(--border); }
.share-label { font-family: var(--font-brand); font-size: 0.75rem; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: 0.1em; white-space: nowrap; }
.share-buttons { display: flex; gap: 0.45rem; flex-wrap: wrap; }
.share-btn { display: flex; align-items: center; justify-content: center; width: 36px; height: 36px; border-radius: 50%; background: var(--tag-bg); color: #fff; text-decoration: none; border: none; cursor: pointer; transition: background 0.15s, transform 0.15s; flex-shrink: 0; }
.share-btn:hover { background: var(--accent); transform: translateY(-2px); }
.share-btn:active { transform: translateY(0); }

/* Category nav */
.category-nav { background: var(--surface); border-bottom: 1px solid var(--border); }
.category-buttons {
  display: flex;
  justify-content: space-between;
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 clamp(0.5rem, 3vw, 2rem);
}
.category-btn {
  flex: 1 1 0;
  text-align: center;
  padding: clamp(0.55rem, 1.8vw, 0.7rem) clamp(0.15rem, 1.2vw, 1.1rem);
  text-decoration: none;
  color: var(--muted);
  font-family: var(--font-brand);
  font-weight: 600;
  font-size: clamp(0.62rem, 2.4vw, 0.82rem);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: color 0.15s, border-color 0.15s;
}
.category-btn:hover { color: var(--text); }
.category-btn.active { color: var(--accent); font-weight: 700; border-bottom-color: var(--accent); }

/* Light mode overrides */
html.light {
  --bg: #f9f7f4;
  --surface: #ffffff;
  --text: #1a1a1a;
  --muted: #6b7280;
  --accent: #0f4c81;
  --tag-bg: #eef2f7;
  --border: #e5e7eb;
}

html.light .brand-name { color: #000000; }
html.light .brand-name:hover { color: var(--accent); }
html.light .tp { color: #444; }
html.light .category-btn.active { color: #000; border-bottom-color: #000; }
html.light .post-card:hover { box-shadow: 0 8px 30px rgba(0,0,0,0.08); }

/* Toggle button */
.site-brand { flex-direction: row; align-items: center; justify-content: space-between; }
.brand-text { display: flex; flex-direction: column; gap: 0.1rem; }
.theme-toggle {
  background: none; border: 1px solid var(--border); cursor: pointer;
  color: var(--muted); border-radius: 50%; width: 34px; height: 34px;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.15s, color 0.15s; flex-shrink: 0;
}
.theme-toggle:hover { background: var(--tag-bg); color: var(--text); }
.icon-sun  { display: block; }
.icon-moon { display: none; }
html.light .icon-sun  { display: none; }
html.light .icon-moon { display: block; }

/* Author bylines & profiles */
.author-byline { display: flex; align-items: center; gap: 0.75rem; margin: 1.25rem 0 1.75rem; text-decoration: none; width: fit-content; }
.author-avatar { width: 44px; height: 44px; border-radius: 50%; object-fit: cover; flex-shrink: 0; border: 1px solid var(--border); }
.author-info { display: flex; flex-direction: column; line-height: 1.35; }
.author-name { font-family: var(--font-brand); font-weight: 700; font-size: 0.92rem; color: var(--text); }
.author-byline:hover .author-name { color: var(--accent); }
.author-title { font-family: var(--font-ui); font-size: 0.78rem; color: var(--muted); }

.card-meta { display: flex; align-items: center; justify-content: space-between; margin-top: 1rem; gap: 1rem; }
.card-author { color: var(--muted); text-decoration: none; font-weight: 600; }
.card-author:hover { color: var(--accent); }
.card-meta-sep { color: var(--border); }

.author-header { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 0.6rem; padding: 2.5rem 1.5rem 2rem; max-width: 600px; margin: 0 auto; }
.author-avatar-large { width: 96px; height: 96px; border-radius: 50%; object-fit: cover; border: 3px solid var(--surface); box-shadow: 0 2px 12px rgba(0,0,0,0.08); margin-bottom: 0.5rem; }
.author-header h1 { font-size: 1.6rem; font-family: var(--font-brand); }
.author-title-large { font-family: var(--font-brand); font-weight: 700; color: var(--accent); font-size: 0.9rem; text-transform: uppercase; letter-spacing: 0.05em; }
.author-bio { font-family: var(--font-ui); color: var(--muted); font-size: 0.95rem; line-height: 1.65; }

/* Authors directory */
.authors-intro { text-align: center; margin-bottom: 1rem; }
.authors-intro h1 { margin-bottom: 0.5rem; font-family: var(--font-brand); }
.author-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 1.5rem; margin-top: 2rem; }
.author-card { background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 1.75rem 1.25rem; text-align: center; text-decoration: none; transition: box-shadow 0.2s, transform 0.2s; }
.author-card:hover { box-shadow: 0 8px 30px rgba(0,0,0,0.5); transform: translateY(-2px); }
.author-card img { width: 76px; height: 76px; border-radius: 50%; object-fit: cover; margin-bottom: 0.85rem; border: 1px solid var(--border); }
.author-card h3 { font-family: var(--font-brand); font-size: 1rem; color: var(--text); margin-bottom: 0.25rem; }
.author-card p { font-family: var(--font-ui); font-size: 0.8rem; color: var(--muted); }

/* Footer */
.footer-inner { max-width: 1100px; margin: 0 auto; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 1.5rem; padding-bottom: 1.5rem; border-bottom: 1px solid var(--border); }
.footer-brand { display: flex; flex-direction: column; gap: 0.15rem; }
.footer-logo { font-family: var(--font-brand); font-weight: 900; font-size: 1.15rem; color: var(--text); letter-spacing: -0.02em; }
.footer-tagline { font-family: var(--font-ui); font-size: 0.78rem; color: var(--muted); }
.footer-links { display: flex; flex-wrap: wrap; gap: 1.5rem; }
.footer-links a { font-family: var(--font-ui); font-size: 0.85rem; color: var(--muted); text-decoration: none; transition: color 0.15s; }
.footer-links a:hover { color: var(--text); }
.footer-rss { display: flex; align-items: center; justify-content: center; width: 34px; height: 34px; border-radius: 50%; background: var(--tag-bg); color: #fff; flex-shrink: 0; transition: background 0.15s, transform 0.15s; }
.footer-rss:hover { background: var(--accent); transform: translateY(-2px); }
.footer-copy { max-width: 1100px; margin: 1.25rem auto 0; font-family: var(--font-ui); font-size: 0.8rem; color: var(--muted); text-align: center; }

@media (max-width: 640px) {
  .site-footer { padding: 2rem 1.25rem 1.25rem; }
  .footer-inner { flex-direction: column; align-items: flex-start; gap: 1.25rem; }
  .footer-links { gap: 1rem 1.25rem; }
}

/* Search icon in header */
.header-actions { display: flex; align-items: center; gap: 0.5rem; }
.search-btn { display: flex; align-items: center; justify-content: center; width: 34px; height: 34px; border-radius: 50%; border: 1px solid var(--border); color: var(--muted); text-decoration: none; transition: background 0.15s, color 0.15s; }
.search-btn:hover { background: var(--tag-bg); color: var(--text); }

/* Hero Card */
.hero-card { grid-column: span 2; }
.hero-card .card-image-link { position: relative; display: block; }
.hero-badge {
  position: absolute;
  top: 1rem;
  left: 1rem;
  background: var(--accent);
  color: white;
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  z-index: 10;
  font-family: var(--font-brand);
}
.hero-card .card-body { padding: 2rem; }
.hero-card h2 { font-size: 1.75rem; font-family: var(--font-brand); }

@media (max-width: 768px) {
  .hero-card { grid-column: span 1; }
}

.read-time {
  font-family: var(--font-ui);
  font-size: 0.75rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.25rem 0.5rem;
  background: var(--tag-bg);
  border-radius: 4px;
}
.read-more { margin-left: auto; font-family: var(--font-brand); font-size: 0.8rem; font-weight: 700; color: var(--accent); text-decoration: none; }
.read-more:hover { color: var(--text); }