/**
 * AI Tech Circuit - Modern Technology Publication Design System
 * Light & Dark Themes, Responsive Utilities, and Custom Components
 */

@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&family=Inter:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap');
@import url('https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css');
@import url('https://cdn.jsdelivr.net/npm/bootstrap-icons@1.11.3/font/bootstrap-icons.min.css');

/* --------------------------------------------------------------------------
 * 1. Design Tokens & CSS Variables
 * -------------------------------------------------------------------------- */
:root {
  --font-heading: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  /* Brand Palette */
  --color-primary: #6D5DFB;
  --color-primary-hover: #5B4AE3;
  --color-secondary: #00C2FF;
  --color-accent: #8B5CF6;
  --color-dark: #0B1020;

  /* Light Theme (Default) */
  --bg-body: #F7F8FC;
  --bg-surface: #FFFFFF;
  --bg-surface-alt: #F1F4F9;
  --bg-glass: rgba(255, 255, 255, 0.85);
  --text-main: #172033;
  --text-muted: #64748B;
  --text-heading: #0B1020;
  --border-color: #E2E8F0;
  --border-hover: #CBD5E1;
  --card-shadow: 0 4px 20px -2px rgba(11, 16, 32, 0.05), 0 2px 6px -1px rgba(11, 16, 32, 0.03);
  --card-shadow-hover: 0 12px 30px -4px rgba(109, 93, 251, 0.12), 0 4px 10px -2px rgba(11, 16, 32, 0.05);
  --header-height: 72px;
  --topbar-height: 40px;
}

/* Dark Theme */
[data-theme="dark"] {
  --bg-body: #0B1020;
  --bg-surface: #131B2E;
  --bg-surface-alt: #1A243D;
  --bg-glass: rgba(19, 27, 46, 0.88);
  --text-main: #E2E8F0;
  --text-muted: #94A3B8;
  --text-heading: #FFFFFF;
  --border-color: #1E293B;
  --border-hover: #334155;
  --card-shadow: 0 4px 20px -2px rgba(0, 0, 0, 0.35);
  --card-shadow-hover: 0 12px 32px -4px rgba(109, 93, 251, 0.25);
}

/* --------------------------------------------------------------------------
 * 2. Base & Typography
 * -------------------------------------------------------------------------- */
*, *::before, *::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-body);
  background-color: var(--bg-body);
  color: var(--text-main);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background-color 0.25s ease, color 0.25s ease;
}

h1, h2, h3, h4, h5, h6,
.font-heading {
  font-family: var(--font-heading);
  color: var(--text-heading);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.3;
}

a {
  color: var(--color-primary);
  transition: color 0.2s ease, transform 0.2s ease;
}

a:hover {
  color: var(--color-primary-hover);
}

/* --------------------------------------------------------------------------
 * 3. Layout & Header
 * -------------------------------------------------------------------------- */
.top-announcement-bar {
  background: linear-gradient(90deg, #6D5DFB, #8B5CF6, #00C2FF);
  color: #FFFFFF;
  font-size: 0.875rem;
  font-weight: 500;
  padding: 8px 0;
}

.site-navbar {
  background: var(--bg-glass);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 0;
  z-index: 1030;
  transition: background-color 0.25s ease, border-color 0.25s ease;
}

.brand-logo-text {
  font-family: var(--font-heading);
  font-weight: 800;
  font-size: 1.45rem;
  letter-spacing: -0.03em;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-heading);
  text-decoration: none;
}

.brand-logo-icon {
  width: 34px;
  height: 34px;
  background: linear-gradient(135deg, var(--color-primary), var(--color-secondary));
  color: #FFFFFF;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.15rem;
  box-shadow: 0 4px 12px rgba(109, 93, 251, 0.35);
}

.nav-link-custom {
  font-weight: 600;
  font-size: 0.9375rem;
  color: var(--text-main) !important;
  padding: 8px 14px !important;
  border-radius: 8px;
  transition: all 0.2s ease;
}

.nav-link-custom:hover,
.nav-link-custom.active {
  color: var(--color-primary) !important;
  background: var(--bg-surface-alt);
}

/* --------------------------------------------------------------------------
 * 4. Cards & Post Blocks
 * -------------------------------------------------------------------------- */
.post-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: var(--card-shadow);
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.25s ease, border-color 0.25s ease;
  display: flex;
  flex-direction: column;
  height: 100%;
}

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

.post-card-thumb-link {
  position: relative;
  display: block;
  padding-top: 56.25%; /* 16:9 Aspect Ratio */
  overflow: hidden;
  background-color: var(--bg-surface-alt);
}

.post-card-thumb {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s ease;
}

.post-card:hover .post-card-thumb {
  transform: scale(1.05);
}

.post-card-body {
  padding: 20px;
  display: flex;
  flex-direction: column;
  flex-grow: 1;
}

.post-category-badge {
  display: inline-flex;
  align-items: center;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 4px 10px;
  border-radius: 20px;
  background: rgba(109, 93, 251, 0.1);
  color: var(--color-primary);
  text-decoration: none;
  width: fit-content;
  margin-bottom: 12px;
  transition: all 0.2s ease;
}

.post-category-badge:hover {
  background: var(--color-primary);
  color: #FFFFFF;
}

.post-title {
  font-size: 1.15rem;
  margin-bottom: 10px;
  line-height: 1.4;
}

.post-title a {
  color: var(--text-heading);
  text-decoration: none;
}

.post-title a:hover {
  color: var(--color-primary);
}

.post-excerpt {
  color: var(--text-muted);
  font-size: 0.875rem;
  line-height: 1.55;
  margin-bottom: 16px;
  flex-grow: 1;
}

.post-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 0.8125rem;
  color: var(--text-muted);
  padding-top: 14px;
  border-top: 1px solid var(--border-color);
}

.author-avatar-sm {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  object-fit: cover;
}

/* --------------------------------------------------------------------------
 * 5. Hero Asymmetric Section
 * -------------------------------------------------------------------------- */
.hero-featured-card {
  position: relative;
  border-radius: 20px;
  overflow: hidden;
  height: 100%;
  min-height: 440px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 36px;
  background-size: cover;
  background-position: center;
}

.hero-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(11, 16, 32, 0.1) 0%, rgba(11, 16, 32, 0.85) 65%, #0B1020 100%);
  z-index: 1;
}

.hero-featured-content {
  position: relative;
  z-index: 2;
  color: #FFFFFF;
}

.hero-featured-content h2 a {
  color: #FFFFFF;
  text-decoration: none;
}

.hero-featured-content h2 a:hover {
  color: var(--color-secondary);
}

/* --------------------------------------------------------------------------
 * 6. Trending Ticker Bar
 * -------------------------------------------------------------------------- */
.trending-ticker-container {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 8px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 24px;
}

.ticker-badge {
  background: linear-gradient(135deg, #EF4444, #F97316);
  color: #FFFFFF;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  padding: 4px 10px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
}

.ticker-marquee {
  overflow: hidden;
  white-space: nowrap;
  flex-grow: 1;
}

.ticker-link {
  color: var(--text-main);
  text-decoration: none;
  font-weight: 500;
  font-size: 0.875rem;
  margin-right: 32px;
}

.ticker-link:hover {
  color: var(--color-primary);
}

/* --------------------------------------------------------------------------
 * 7. Single Article & Reading Experience
 * -------------------------------------------------------------------------- */
.reading-progress-bar {
  position: fixed;
  top: 0;
  left: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--color-primary), var(--color-secondary));
  width: 0%;
  z-index: 2000;
  transition: width 0.1s linear;
}

.article-header {
  margin-bottom: 32px;
}

.article-title {
  font-size: 2.35rem;
  font-weight: 800;
  line-height: 1.25;
  margin-bottom: 16px;
}

.article-subtitle {
  font-size: 1.15rem;
  color: var(--text-muted);
  line-height: 1.5;
  margin-bottom: 20px;
}

.article-meta-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 16px;
  padding: 16px 0;
  border-top: 1px solid var(--border-color);
  border-bottom: 1px solid var(--border-color);
  font-size: 0.875rem;
  color: var(--text-muted);
}

.article-author-info {
  display: flex;
  align-items: center;
  gap: 10px;
}

.article-author-img {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  object-fit: cover;
}

.article-featured-image-wrapper {
  margin: 28px 0;
  border-radius: 16px;
  overflow: hidden;
}

.article-featured-img {
  width: 100%;
  max-height: 520px;
  object-fit: cover;
}

.article-body {
  font-size: 1.125rem;
  line-height: 1.8;
  color: var(--text-main);
}

.article-body h2 {
  font-size: 1.65rem;
  margin-top: 40px;
  margin-bottom: 18px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border-color);
}

.article-body h3 {
  font-size: 1.35rem;
  margin-top: 28px;
  margin-bottom: 14px;
}

.article-body p {
  margin-bottom: 22px;
}

.article-body ul, .article-body ol {
  margin-bottom: 24px;
  padding-left: 28px;
}

.article-body li {
  margin-bottom: 8px;
}

/* Callout Box */
.callout-box {
  background: var(--bg-surface-alt);
  border-left: 4px solid var(--color-primary);
  border-radius: 0 12px 12px 0;
  padding: 20px 24px;
  margin: 28px 0;
}

.callout-box h4 {
  font-size: 1.1rem;
  margin-bottom: 8px;
  color: var(--color-primary);
}

/* Table of Contents Box */
.table-of-contents-box {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: 14px;
  padding: 18px 22px;
  box-shadow: var(--card-shadow);
}

.toc-header {
  font-size: 1rem;
  font-weight: 700;
}

.toc-list {
  list-style: none;
  padding-left: 0;
}

.toc-item {
  margin-bottom: 6px;
}

.toc-link {
  color: var(--text-muted);
  font-size: 0.9375rem;
  display: block;
  padding: 3px 0;
  transition: all 0.2s ease;
}

.toc-link:hover,
.toc-link.active {
  color: var(--color-primary);
  font-weight: 600;
  transform: translateX(4px);
}

/* Social Share Bar */
.share-bar-container {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin: 28px 0;
  padding: 16px 0;
  border-top: 1px solid var(--border-color);
  border-bottom: 1px solid var(--border-color);
}

.btn-share {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8125rem;
  font-weight: 600;
  padding: 6px 14px;
  border-radius: 8px;
  border: 1px solid var(--border-color);
  background: var(--bg-surface);
  color: var(--text-main);
  text-decoration: none;
  transition: all 0.2s ease;
}

.btn-share:hover {
  background: var(--color-primary);
  color: #FFFFFF;
  border-color: var(--color-primary);
}

/* --------------------------------------------------------------------------
 * 8. Author Box & E-E-A-T Cards
 * -------------------------------------------------------------------------- */
.author-bio-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 28px;
  margin: 40px 0;
  box-shadow: var(--card-shadow);
}

.author-bio-avatar {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid var(--color-primary);
}

/* --------------------------------------------------------------------------
 * 9. Monetization & Ad Containers (CLS Protected)
 * -------------------------------------------------------------------------- */
.ad-container-slot {
  background: var(--bg-surface-alt);
  border: 1px dashed var(--border-color);
  border-radius: 12px;
  padding: 14px;
  min-height: 100px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.ad-badge-label {
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--text-muted);
}

.ad-placeholder-box {
  padding: 16px;
  text-align: center;
}

/* --------------------------------------------------------------------------
 * 10. Footer & Back-to-Top
 * -------------------------------------------------------------------------- */
.site-footer {
  background: var(--bg-surface);
  border-top: 1px solid var(--border-color);
  padding: 64px 0 28px;
  margin-top: 80px;
  transition: background-color 0.25s ease;
}

.footer-brand-title {
  font-size: 1.35rem;
  font-weight: 800;
  margin-bottom: 14px;
}

.footer-heading {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 18px;
  color: var(--text-heading);
}

.footer-links {
  list-style: none;
  padding-left: 0;
}

.footer-links li {
  margin-bottom: 10px;
}

.footer-links a {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.875rem;
  transition: color 0.2s ease;
}

.footer-links a:hover {
  color: var(--color-primary);
}

.back-to-top-btn {
  position: fixed;
  bottom: 28px;
  right: 28px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--color-primary);
  color: #FFFFFF;
  border: none;
  box-shadow: 0 6px 16px rgba(109, 93, 251, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  transform: translateY(10px);
  transition: all 0.3s ease;
  z-index: 1000;
}

.back-to-top-btn.visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

/* --------------------------------------------------------------------------
 * 11. Cookie Consent Banner
 * -------------------------------------------------------------------------- */
.cookie-banner {
  position: fixed;
  bottom: 24px;
  left: 24px;
  right: 24px;
  max-width: 520px;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 22px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.2);
  z-index: 2050;
  display: none;
}

/* --------------------------------------------------------------------------
 * 12. Search Modal
 * -------------------------------------------------------------------------- */
.search-modal .modal-content {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: 20px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.search-input-lg {
  font-size: 1.2rem;
  padding: 16px 20px;
  border-radius: 12px;
  background: var(--bg-surface-alt);
  border: 2px solid transparent;
  color: var(--text-main);
}

.search-input-lg:focus {
  background: var(--bg-surface);
  border-color: var(--color-primary);
  box-shadow: none;
}
