/*
Theme Name: TechPulse
Theme URI: https://example.com/techpulse
Author: TechPulse
Author URI: https://example.com
Description: A modern, responsive tech news theme that auto-loads live news from top tech sources (TechCrunch, The Verge, Wired, Ars Technica, Engadget, Hacker News, MIT Technology Review) via RSS feeds. Features dark/light mode toggle, category filtering, real-time search, hero featured article, and auto-refresh every 10 minutes. Built with vanilla JavaScript — no jQuery required.
Version: 1.0.0
Requires at least: 5.0
Tested up to: 6.4
Requires PHP: 7.0
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Text Domain: techpulse
Tags: news, magazine, blog, dark-mode, responsive-layout, custom-colors, custom-menu, featured-images, threaded-comments, translation-ready
*/

:root {
  --bg: #ffffff;
  --bg-soft: #f7f8fa;
  --bg-card: #ffffff;
  --text: #0a0a0a;
  --text-muted: #5a5a6a;
  --border: #e6e8ec;
  --accent: #ff3b3b;
  --accent-soft: #ffe5e5;
  --tag-bg: #f0f1f5;
  --shadow: 0 4px 16px rgba(0,0,0,0.04);
  --shadow-hover: 0 12px 32px rgba(0,0,0,0.08);
}
[data-theme="dark"] {
  --bg: #0a0a0f;
  --bg-soft: #12121a;
  --bg-card: #1a1a24;
  --text: #f0f0f5;
  --text-muted: #9090a0;
  --border: #2a2a3a;
  --accent: #ff5252;
  --accent-soft: #2a1515;
  --tag-bg: #22222e;
  --shadow: 0 4px 16px rgba(0,0,0,0.3);
  --shadow-hover: 0 12px 32px rgba(0,0,0,0.5);
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  transition: background 0.3s, color 0.3s;
  min-height: 100vh;
}
a { color: inherit; text-decoration: none; }

/* HEADER */
.tp-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
.tp-header-inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: 16px 24px;
  display: flex;
  align-items: center;
  gap: 24px;
}
.tp-logo {
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 700;
  font-size: 24px;
  letter-spacing: -0.5px;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
}
.tp-logo-dot {
  width: 10px;
  height: 10px;
  background: var(--accent);
  border-radius: 50%;
  animation: tp-pulse 2s infinite;
}
@keyframes tp-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.6; transform: scale(1.2); }
}
.tp-search-wrap {
  flex: 1;
  max-width: 480px;
  position: relative;
}
.tp-search-input {
  width: 100%;
  padding: 10px 16px 10px 42px;
  border: 1px solid var(--border);
  border-radius: 24px;
  background: var(--bg-soft);
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
  outline: none;
  transition: border 0.2s, box-shadow 0.2s;
}
.tp-search-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.tp-search-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  width: 18px;
  height: 18px;
  color: var(--text-muted);
}
.tp-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}
.tp-icon-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--bg-soft);
  color: var(--text);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}
.tp-icon-btn:hover {
  background: var(--accent-soft);
  border-color: var(--accent);
}

/* CATEGORIES */
.tp-categories {
  max-width: 1280px;
  margin: 0 auto;
  padding: 20px 24px 0;
  display: flex;
  gap: 8px;
  overflow-x: auto;
  scrollbar-width: none;
}
.tp-categories::-webkit-scrollbar { display: none; }
.tp-cat-btn {
  padding: 8px 18px;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  font-family: inherit;
  transition: all 0.2s;
}
.tp-cat-btn:hover { border-color: var(--accent); }
.tp-cat-btn.active {
  background: var(--text);
  color: var(--bg);
  border-color: var(--text);
}

/* MAIN */
.tp-main {
  max-width: 1280px;
  margin: 0 auto;
  padding: 32px 24px 80px;
}
.tp-section-title {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 28px;
  font-weight: 700;
  margin-bottom: 24px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.tp-live-badge {
  background: var(--accent);
  color: white;
  font-size: 11px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 12px;
  letter-spacing: 0.5px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.tp-live-dot {
  width: 6px;
  height: 6px;
  background: white;
  border-radius: 50%;
  animation: tp-pulse 1.5s infinite;
}

/* HERO */
.tp-hero {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 24px;
  margin-bottom: 48px;
}
.tp-hero-main, .tp-hero-side-item {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
  display: block;
}
.tp-hero-main:hover, .tp-hero-side-item:hover, .tp-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-hover);
}
.tp-hero-main-img {
  width: 100%;
  height: 380px;
  object-fit: cover;
  background: var(--bg-soft);
}
.tp-hero-main-content { padding: 24px; }
.tp-hero-main-title {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 28px;
  font-weight: 700;
  line-height: 1.2;
  margin-bottom: 12px;
}
.tp-hero-main-desc {
  color: var(--text-muted);
  font-size: 15px;
  margin-bottom: 16px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.tp-hero-side {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.tp-hero-side-item {
  display: flex;
  gap: 12px;
  padding: 12px;
}
.tp-hero-side-img {
  width: 100px;
  height: 100px;
  object-fit: cover;
  border-radius: 8px;
  flex-shrink: 0;
  background: var(--bg-soft);
}
.tp-hero-side-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}
.tp-hero-side-title {
  font-size: 15px;
  font-weight: 600;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* GRID */
.tp-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 24px;
}
.tp-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
  display: flex;
  flex-direction: column;
}
.tp-card-img {
  width: 100%;
  height: 200px;
  object-fit: cover;
  background: var(--bg-soft);
}
.tp-card-body {
  padding: 20px;
  flex: 1;
  display: flex;
  flex-direction: column;
}
.tp-card-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  font-size: 12px;
  color: var(--text-muted);
}
.tp-source-tag {
  background: var(--tag-bg);
  color: var(--text);
  padding: 4px 10px;
  border-radius: 12px;
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.tp-card-title {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 18px;
  font-weight: 700;
  line-height: 1.3;
  margin-bottom: 10px;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.tp-card-desc {
  color: var(--text-muted);
  font-size: 14px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-bottom: auto;
  padding-bottom: 12px;
}
.tp-card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 12px;
  border-top: 1px solid var(--border);
  font-size: 12px;
  color: var(--text-muted);
}

/* LOADER */
.tp-loader-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 80px 20px;
  gap: 16px;
}
.tp-loader {
  width: 48px;
  height: 48px;
  border: 4px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: tp-spin 0.8s linear infinite;
}
@keyframes tp-spin { to { transform: rotate(360deg); } }
.tp-loader-text {
  color: var(--text-muted);
  font-size: 14px;
}
.tp-empty {
  text-align: center;
  padding: 80px 20px;
  color: var(--text-muted);
}
.tp-empty-icon { font-size: 48px; margin-bottom: 16px; }

/* FOOTER */
.tp-footer {
  border-top: 1px solid var(--border);
  padding: 32px 24px;
  text-align: center;
  color: var(--text-muted);
  font-size: 14px;
  background: var(--bg-soft);
}
.tp-footer a { color: var(--accent); }

/* RESPONSIVE */
@media (max-width: 900px) {
  .tp-hero { grid-template-columns: 1fr; }
  .tp-hero-main-img { height: 240px; }
  .tp-hero-main-title { font-size: 22px; }
  .tp-section-title { font-size: 22px; }
  .tp-search-wrap { display: none; }
}
@media (max-width: 600px) {
  .tp-header-inner { padding: 12px 16px; gap: 12px; }
  .tp-main { padding: 24px 16px 60px; }
  .tp-categories { padding: 16px 16px 0; }
  .tp-grid { grid-template-columns: 1fr; }
}

/* FAB */
.tp-fab {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--accent);
  color: white;
  border: none;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(255,59,59,0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s;
  z-index: 50;
}
.tp-fab:hover { transform: scale(1.1); }
.tp-fab.spinning svg { animation: tp-spin 1s linear infinite; }

/* WordPress required classes */
.alignleft { float: left; margin-right: 1em; }
.alignright { float: right; margin-left: 1em; }
.aligncenter { display: block; margin-left: auto; margin-right: auto; }
.screen-reader-text {
  clip: rect(1px, 1px, 1px, 1px);
  position: absolute !important;
  height: 1px;
  width: 1px;
  overflow: hidden;
}
.sticky { display: block; }
.bypostauthor { display: block; }
.gallery-caption { display: block; }
.wp-caption { max-width: 100%; }
.wp-caption-text { text-align: center; }
