/* ===========================
   RESET & VARIABLES
=========================== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:          #f5f7fa;
  --surface:     #ffffff;
  --border:      #e2e8f0;
  --text:        #1a202c;
  --text-muted:  #718096;
  --accent:      #6c63ff;
  --accent-dark: #5a52d5;
  --ai:          #7c3aed;
  --gadgets:     #0891b2;
  --startups:    #d97706;
  --science:     #059669;
  --reviews:     #db2777;
  --cyber:       #dc2626;
  --software:    #3b82f6;
  --radius:      12px;
  --shadow:      0 4px 20px rgba(0,0,0,0.08);
  --transition:  0.25s ease;
  --header-h:    64px;
}

[data-theme="dark"] {
  --bg:         #0f1117;
  --surface:    #1a1d27;
  --border:     #2d3148;
  --text:       #e2e8f0;
  --text-muted: #a0aec0;
  --shadow:     0 4px 20px rgba(0,0,0,0.4);
}

html { scroll-behavior: smooth; }

body {
  font-family: 'Segoe UI', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  transition: background var(--transition), color var(--transition);
}

img { display: block; width: 100%; object-fit: cover; }
a { color: inherit; text-decoration: none; }
ul { list-style: none; }
button { cursor: pointer; border: none; background: none; font-family: inherit; }

/* ===========================
   LAYOUT UTILITIES
=========================== */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1.25rem;
}

.layout {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 2rem;
  margin-top: 2.5rem;
  margin-bottom: 2rem;
  align-items: start;
}

/* ===========================
   BUTTONS
=========================== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.55rem 1.2rem;
  border-radius: 8px;
  font-size: 0.875rem;
  font-weight: 600;
  transition: all var(--transition);
}

.btn--primary {
  background: var(--accent);
  color: #fff;
}
.btn--primary:hover { background: var(--accent-dark); transform: translateY(-1px); }

.btn--outline {
  border: 2px solid var(--accent);
  color: var(--accent);
}
.btn--outline:hover { background: var(--accent); color: #fff; }

.btn--full { width: 100%; justify-content: center; margin-top: 0.5rem; }
.btn--lg { padding: 0.75rem 2rem; font-size: 1rem; }

.btn--search, .btn--theme {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.45rem 0.7rem;
  color: var(--text);
  font-size: 1rem;
}
.btn--search:hover, .btn--theme:hover { background: var(--accent); color: #fff; border-color: var(--accent); }

.icon-btn {
  background: none;
  color: var(--text-muted);
  font-size: 0.95rem;
  padding: 0.3rem 0.5rem;
  border-radius: 6px;
  transition: color var(--transition), background var(--transition);
}
.icon-btn:hover { color: var(--accent); background: rgba(108,99,255,0.08); }

/* ===========================
   HEADER & LOGO
=========================== */
.header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 2px 12px rgba(0,0,0,0.06);
}

.header__inner {
  display: flex;
  align-items: center;
  height: var(--header-h);
  gap: 1.5rem;
}

.logo, .article-view__logo, .page-view__logo {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--accent);
  white-space: nowrap;
  letter-spacing: -0.5px;
}

.logo__img {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  object-fit: cover;
}

.nav { flex: 1; }
.nav__list { display: flex; gap: 0.25rem; }
.nav__link {
  padding: 0.4rem 0.75rem;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-muted);
  transition: all var(--transition);
}
.nav__link:hover, .nav__link.active {
  color: var(--accent);
  background: rgba(108,99,255,0.08);
}

.header__actions { display: flex; align-items: center; gap: 0.5rem; }

.hamburger {
  display: none;
  flex-direction: column;
  gap: 5px;
  padding: 0.4rem;
}
.hamburger span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--text);
  border-radius: 2px;
  transition: all var(--transition);
}

/* Search Bar */
.search-bar {
  display: none;
  padding: 0.75rem 0;
  border-top: 1px solid var(--border);
  background: var(--surface);
}
.search-bar.open { display: block; }
.search-bar .container { display: flex; gap: 0.5rem; align-items: center; }
.search-bar__input {
  flex: 1;
  padding: 0.6rem 1rem;
  border: 2px solid var(--border);
  border-radius: 8px;
  font-size: 0.95rem;
  background: var(--bg);
  color: var(--text);
  outline: none;
  transition: border-color var(--transition);
}
.search-bar__input:focus { border-color: var(--accent); }
.search-bar__close { color: var(--text-muted); font-size: 1.1rem; padding: 0.4rem; }
.search-bar__close:hover { color: var(--accent); }

/* ===========================
   BREAKING TICKER
=========================== */
.ticker {
  background: var(--accent);
  color: #fff;
  display: flex;
  align-items: center;
  font-size: 0.82rem;
  font-weight: 500;
  overflow: hidden;
  height: 36px;
}
.ticker__label {
  background: rgba(0,0,0,0.25);
  padding: 0 1rem;
  height: 100%;
  display: flex;
  align-items: center;
  white-space: nowrap;
  font-weight: 700;
  letter-spacing: 1px;
  font-size: 0.75rem;
}
.ticker__track {
  flex: 1;
  overflow: hidden;
  white-space: nowrap;
}
.ticker__track span {
  display: inline-block;
  animation: ticker 35s linear infinite;
}
@keyframes ticker {
  0%   { transform: translateX(100vw); }
  100% { transform: translateX(-100%); }
}

/* ===========================
   BADGES
=========================== */
.badge {
  display: inline-block;
  padding: 0.2rem 0.65rem;
  border-radius: 50px;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  color: #fff;
}
.badge--ai       { background: var(--ai); }
.badge--gadgets  { background: var(--gadgets); }
.badge--startups { background: var(--startups); }
.badge--science  { background: var(--science); }
.badge--reviews  { background: var(--reviews); }
.badge--cyber    { background: var(--cyber); }
.badge--software { background: var(--software); }

/* ===========================
   CARDS
=========================== */
.card {
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: transform var(--transition), box-shadow var(--transition);
}
.card:hover { transform: translateY(-4px); box-shadow: 0 12px 32px rgba(0,0,0,0.12); }

.card__img-wrap { position: relative; }
.card__img-wrap .badge { position: absolute; top: 0.75rem; left: 0.75rem; }
.card__img { height: 220px; }

.card__body { padding: 1.1rem 1.25rem 1.25rem; }
.card__meta { font-size: 0.78rem; color: var(--text-muted); display: block; margin-bottom: 0.4rem; }
.card__title { font-size: 1.05rem; font-weight: 700; line-height: 1.4; margin-bottom: 0.5rem; color: var(--text); }
.card__title--lg { font-size: 1.5rem; }
.card__title--sm { font-size: 0.9rem; }
.card__excerpt { font-size: 0.875rem; color: var(--text-muted); margin-bottom: 1rem; line-height: 1.55; }

.card__footer { display: flex; align-items: center; justify-content: space-between; }
.card__actions { display: flex; gap: 0.25rem; }

/* Horizontal Card */
.card--horizontal {
  display: flex;
  flex-direction: row;
  height: auto;
}
.card__img--sm { width: 110px; min-width: 110px; height: 90px; }
.card--horizontal .card__body { padding: 0.75rem; }
.card--horizontal .card__title { font-size: 0.85rem; margin-top: 0.25rem; }

/* Clickable card cursor */
.card[data-article] { cursor: pointer; }

/* ===========================
   HERO SECTION
=========================== */
.hero {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 1.5rem;
  margin-top: 1.75rem;
}
.hero__main .card__img { height: 320px; }
.hero__sidebar { display: flex; flex-direction: column; gap: 1rem; }

/* ===========================
   FILTER BAR
=========================== */
.filter-bar {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  padding: 1.5rem 0 0.5rem;
}
.filter-btn {
  padding: 0.4rem 1rem;
  border-radius: 50px;
  border: 2px solid var(--border);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  background: var(--surface);
  transition: all var(--transition);
}
.filter-btn:hover, .filter-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

/* ===========================
   NEWS GRID
=========================== */
.news-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.5rem;
}
.news-card { display: flex; flex-direction: column; }
.news-card .card__body { flex: 1; display: flex; flex-direction: column; }
.news-card .card__footer { margin-top: auto; }

/* ===========================
   SIDEBAR WIDGETS
=========================== */
.sidebar { display: flex; flex-direction: column; gap: 1.5rem; }

.widget {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  box-shadow: var(--shadow);
}
.widget__title { font-size: 1rem; font-weight: 700; margin-bottom: 0.85rem; }
.widget__text { font-size: 0.875rem; color: var(--text-muted); margin-bottom: 0.75rem; }
.widget__input {
  width: 100%;
  padding: 0.55rem 0.85rem;
  border: 2px solid var(--border);
  border-radius: 8px;
  font-size: 0.875rem;
  background: var(--bg);
  color: var(--text);
  outline: none;
  transition: border-color var(--transition);
}
.widget__input:focus { border-color: var(--accent); }

.trending-list { counter-reset: trending; display: flex; flex-direction: column; gap: 0.6rem; }
.trending-list li {
  counter-increment: trending;
  display: flex;
  gap: 0.65rem;
  font-size: 0.875rem;
  align-items: baseline;
}
.trending-list li::before {
  content: counter(trending);
  font-weight: 800;
  color: var(--accent);
  font-size: 1rem;
  min-width: 1.1rem;
}
.trending-list a:hover { color: var(--accent); }

.tag-cloud { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.tag {
  padding: 0.3rem 0.8rem;
  border-radius: 50px;
  background: var(--bg);
  border: 1px solid var(--border);
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--text-muted);
  transition: all var(--transition);
}
.tag:hover { background: var(--accent); border-color: var(--accent); color: #fff; }

/* ===========================
   FOOTER
=========================== */
.footer {
  background: var(--surface);
  border-top: 1px solid var(--border);
  margin-top: 3rem;
}
.footer__inner {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: 2rem;
  padding: 2.5rem 1.25rem;
}
.footer__brand p { font-size: 0.875rem; color: var(--text-muted); margin-top: 0.5rem; }
.footer__social { display: flex; gap: 0.75rem; margin-top: 1rem; }
.footer__social a {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--bg);
  border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  color: var(--text-muted);
  transition: all var(--transition);
}
.footer__social a:hover { background: var(--accent); border-color: var(--accent); color: #fff; }
.footer__links h4 { font-size: 0.9rem; margin-bottom: 0.85rem; }
.footer__links ul { display: flex; flex-direction: column; gap: 0.5rem; }
.footer__links a { font-size: 0.875rem; color: var(--text-muted); cursor: pointer;}
.footer__links a:hover { color: var(--accent); }
.footer__bottom {
  text-align: center;
  padding: 1rem;
  border-top: 1px solid var(--border);
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* ===========================
   FULL PAGE VIEWS (Article & Pages)
=========================== */
.article-view, .page-view {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: var(--bg);
  overflow-y: auto;
  transform: translateX(100%);
  transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

.article-view.is-open, .page-view.is-open {
  transform: translateX(0);
}

.article-view__topbar, .page-view__topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 2px 12px rgba(0,0,0,0.06);
  padding: 0 1.25rem;
  height: var(--header-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.article-view__back, .page-view__back {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--accent);
  padding: 0.45rem 1rem;
  border-radius: 8px;
  border: 2px solid var(--accent);
  background: transparent;
  transition: all var(--transition);
}
.article-view__back:hover, .page-view__back:hover { background: var(--accent); color: #fff; }

.article-detail {
  max-width: 800px;
  padding-bottom: 4rem;
}

.article-detail__hero {
  position: relative;
  margin-top: 2rem;
  border-radius: var(--radius);
  overflow: hidden;
}
.article-detail__hero img {
  width: 100%;
  height: 420px;
  object-fit: cover;
}
.article-detail__hero .badge {
  position: absolute;
  top: 1.25rem;
  left: 1.25rem;
  font-size: 0.8rem;
  padding: 0.3rem 0.9rem;
}

.article-detail__body {
  padding: 2rem 0;
}

.article-detail__meta {
  display: flex;
  align-items: center;
  gap: 1rem;
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-bottom: 1rem;
  flex-wrap: wrap;
}
.article-detail__meta span {
  display: flex;
  align-items: center;
  gap: 0.3rem;
}

.article-detail__title {
  font-size: 2rem;
  font-weight: 800;
  line-height: 1.25;
  color: var(--text);
  margin-bottom: 1.25rem;
}

.article-detail__author {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1rem 0;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  margin-bottom: 2rem;
}

.article-detail__author-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 700;
  font-size: 1.1rem;
  flex-shrink: 0;
}

.article-detail__author-info strong {
  display: block;
  font-size: 0.9rem;
  font-weight: 700;
}
.article-detail__author-info span {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.article-content {
  font-size: 1.05rem;
  line-height: 1.8;
  color: var(--text);
}

.article-content p {
  margin-bottom: 1.5rem;
}

.article-content h2 {
  font-size: 1.4rem;
  font-weight: 700;
  margin: 2rem 0 0.75rem;
  color: var(--text);
}

.article-content h3 {
  font-size: 1.15rem;
  font-weight: 700;
  margin: 1.5rem 0 0.5rem;
  color: var(--text);
}

.article-content blockquote {
  border-left: 4px solid var(--accent);
  padding: 0.75rem 1.25rem;
  margin: 1.5rem 0;
  background: rgba(108,99,255,0.06);
  border-radius: 0 8px 8px 0;
  font-style: italic;
  color: var(--text-muted);
}

.article-content strong { color: var(--text); }

.article-content ul, .article-content ol {
  margin: 0 0 1.5rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.article-content ul { list-style: disc; }
.article-content ol { list-style: decimal; }

.article-content .highlight-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
  margin: 1.5rem 0;
}

.article-content .highlight-box p { margin-bottom: 0; }

.article-share {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1.5rem 0;
  border-top: 1px solid var(--border);
  margin-top: 2rem;
  font-size: 0.9rem;
  font-weight: 600;
}

.article-share__btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.45rem 1rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  font-size: 0.85rem;
  font-weight: 600;
  background: var(--surface);
  color: var(--text-muted);
  transition: all var(--transition);
}
.article-share__btn:hover { border-color: var(--accent); color: var(--accent); background: rgba(108,99,255,0.06); }

/* Static Page Details */
.page-detail {
  max-width: 800px;
  margin: 0 auto;
  padding: 3rem 1.25rem 5rem;
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-top: 3rem;
  border: 1px solid var(--border);
}
.page-detail h1 {
  font-size: 2.2rem;
  font-weight: 800;
  line-height: 1.25;
  color: var(--text);
  margin-bottom: 1.5rem;
}
.page-detail h2 {
  font-size: 1.4rem;
  font-weight: 700;
  margin: 2rem 0 1rem;
  color: var(--text);
}
.page-detail p {
  font-size: 1.05rem;
  line-height: 1.8;
  margin-bottom: 1.25rem;
  color: var(--text);
}
.page-detail ul {
  margin: 0 0 1.5rem 1.5rem;
  list-style: disc;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  font-size: 1.05rem;
  color: var(--text);
}
.page-detail a {
  color: var(--accent);
  font-weight: 600;
}
.page-detail a:hover {
  text-decoration: underline;
}

/* ===========================
   RESPONSIVE
=========================== */
@media (max-width: 1024px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
  .footer__inner { grid-template-columns: 1fr 1fr; }
  .footer__brand { grid-column: 1 / -1; }
}

@media (max-width: 768px) {
  .hero { grid-template-columns: 1fr; }
  .hero__sidebar { display: none; }

  .nav {
    display: none;
    position: absolute;
    top: var(--header-h);
    left: 0; right: 0;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    padding: 1rem;
    z-index: 99;
  }
  .nav.open { display: block; }
  .nav__list { flex-direction: column; gap: 0.25rem; }
  .nav__link { display: block; padding: 0.6rem 1rem; }

  .hamburger { display: flex; }
  .footer__inner { grid-template-columns: 1fr; }

  .article-detail__title { font-size: 1.5rem; }
  .page-detail h1 { font-size: 1.75rem; }
  .article-detail__hero img { height: 260px; }
  .page-detail { margin-top: 1rem; padding: 2rem 1rem; }
}

@media (max-width: 480px) {
  .news-grid { grid-template-columns: 1fr; }
  .filter-bar { gap: 0.35rem; }
  .filter-btn { padding: 0.35rem 0.75rem; font-size: 0.78rem; }
  .article-detail__title { font-size: 1.25rem; }
}