/* Subticker - Mobile-first, dark/light, PageSpeed-optimized */

:root {
  --bg: #fafafa;
  --bg2: #f0f0f0;
  --fg: #1a1a1a;
  --muted: #6b7280;
  --border: #e5e7eb;
  --accent: #2563eb;
  --accent-hover: #1d4ed8;
  --hover: rgba(0,0,0,.05);
  --card: #ffffff;
  --input-bg: #ffffff;
  --input-border: #d1d5db;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.25rem;
  --space-6: 1.5rem;
  --space-8: 2rem;
}

html.theme-light {
  /* same as :root - explicit light */
}
html.theme-dark {
  --bg: #0f0f0f;
  --bg2: #1a1a1a;
  --fg: #f5f5f5;
  --muted: #9ca3af;
  --border: #2d2d2d;
  --accent: #3b82f6;
  --accent-hover: #60a5fa;
  --hover: rgba(255,255,255,.08);
  --card: #1a1a1a;
  --input-bg: #262626;
  --input-border: #404040;
}

/* Tailwind-style utility classes using CSS variables */
.bg-bg { background-color: var(--bg); }
.bg-bg2 { background-color: var(--bg2); }
.bg-muted { background-color: var(--muted); opacity: 0.2; }
.bg-hover { background-color: var(--hover); }
.text-fg { color: var(--fg); }
.text-muted { color: var(--muted); }
.text-accent { color: var(--accent); }
.border-border { border-color: var(--border); }
.surface-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}

/* Typography system */
h1, h2, h3, h4 { letter-spacing: -0.01em; }
.text-display { font-size: clamp(1.9rem, 3.5vw, 2.6rem); line-height: 1.15; font-weight: 800; }
.text-title { font-size: clamp(1.3rem, 2vw, 1.75rem); line-height: 1.25; font-weight: 700; }
.text-body { font-size: 1rem; line-height: 1.7; }
.text-caption { font-size: 0.8125rem; color: var(--muted); }

/* Nav */
.nav-link {
  color: var(--muted);
  text-decoration: none;
  font-size: 0.9375rem;
  padding: 0.375rem 0.5rem;
  border-radius: 0.5rem;
  transition: color .15s, background-color .15s;
}
.nav-link:hover { color: var(--fg); background-color: var(--hover); }

/* Cards & links */
.card a { text-decoration: none; color: inherit; }
.card-article { text-decoration: none; color: inherit; display: block; }
.card-article:hover .latest-title,
.card-article:hover .hero-main-title,
.card-article:hover .hero-side-title,
.card-article:hover .popular-title { color: var(--accent); }
.card-cat { font-size: 0.75rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; color: var(--accent); }
.card-time { font-size: 0.8125rem; color: var(--muted); }
.line-clamp-2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* Section labels */
.section-label {
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--fg);
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid var(--accent);
  display: inline-block;
}

/* Hero - Today's top */
.hero-section .hero-grid { display: grid; gap: 1rem; }
@media (min-width: 768px) {
  .hero-grid { grid-template-columns: 1.2fr 1fr; grid-template-rows: auto auto; }
  .hero-main { grid-row: 1 / -1; }
}
.hero-main { border-radius: 14px; overflow: hidden; background: linear-gradient(180deg, var(--card), var(--bg2)); border: 1px solid var(--border); transition: box-shadow 0.2s, transform 0.2s; }
.hero-main:hover { box-shadow: 0 12px 26px rgba(0,0,0,0.12); transform: translateY(-2px); }
.hero-main-img { aspect-ratio: 16/9; overflow: hidden; background: var(--bg2); }
.hero-main-img img { width: 100%; height: 100%; object-fit: cover; }
.hero-placeholder { display: flex; align-items: center; justify-content: center; width: 100%; height: 100%; font-size: 3rem; background: var(--bg2); color: var(--muted); }
.hero-main-content { padding: 1.25rem 1.5rem; }
.hero-main-title { font-size: 1.5rem; font-weight: 700; margin: 0.5rem 0 0.75rem; line-height: 1.3; color: var(--fg); transition: color 0.15s; }
.hero-main-excerpt { font-size: 0.9375rem; color: var(--muted); margin: 0; }
.hero-side { display: flex; flex-direction: column; gap: 1rem; }
.hero-side-item { display: flex; gap: 1rem; padding: 0.75rem; border-radius: 10px; background: var(--card); border: 1px solid var(--border); transition: background 0.15s, box-shadow 0.2s; }
.hero-side-item:hover { background: var(--hover); box-shadow: 0 4px 12px rgba(0,0,0,0.06); }
.hero-side-img { width: 120px; min-width: 120px; aspect-ratio: 16/9; border-radius: 8px; overflow: hidden; background: var(--bg2); }
.hero-side-img img { width: 100%; height: 100%; object-fit: cover; }
.hero-side-content { flex: 1; min-width: 0; }
.hero-side-title { font-size: 1rem; font-weight: 600; margin: 0.25rem 0 0; line-height: 1.35; color: var(--fg); transition: color 0.15s; }

/* Popular this week */
.popular-grid { display: grid; gap: 1rem; grid-template-columns: repeat(2, 1fr); }
@media (min-width: 640px) { .popular-grid { grid-template-columns: repeat(4, 1fr); } }
.popular-card { border-radius: 10px; overflow: hidden; background: var(--card); border: 1px solid var(--border); transition: box-shadow 0.2s; }
.popular-card:hover { box-shadow: 0 6px 20px rgba(0,0,0,0.08); }
.popular-img { aspect-ratio: 16/9; overflow: hidden; background: var(--bg2); }
.popular-img img { width: 100%; height: 100%; object-fit: cover; }
.popular-content { padding: 0.75rem 1rem; }
.popular-title { font-size: 0.9375rem; font-weight: 600; margin: 0.25rem 0 0; line-height: 1.35; color: var(--fg); transition: color 0.15s; }

/* V2 home layout */
.home-layout-v2 { align-items: flex-start; }
.content-stack-v2 > section { margin-bottom: var(--space-8); }
.kicker {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  padding: .25rem .6rem;
  border-radius: 999px;
  background: rgba(37,99,235,.12);
  color: var(--accent);
  font-size: .75rem;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
}
.section-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: var(--space-4);
  margin-bottom: var(--space-4);
}
.section-subtle {
  margin: 0;
  color: var(--muted);
  font-size: .9rem;
}

/* Latest grid */
.latest-grid { display: grid; gap: 1.5rem; grid-template-columns: 1fr; }
@media (min-width: 640px) { .latest-grid { grid-template-columns: repeat(2, 1fr); } }
.latest-card { border-radius: 12px; overflow: hidden; background: var(--card); border: 1px solid var(--border); transition: box-shadow 0.2s, transform 0.2s; }
.latest-card:hover { box-shadow: 0 10px 22px rgba(0,0,0,0.1); transform: translateY(-2px); }
.latest-card a { text-decoration: none; color: inherit; }
.latest-img { aspect-ratio: 16/9; overflow: hidden; background: var(--bg2); }
.latest-img img { width: 100%; height: 100%; object-fit: cover; }
.latest-content { padding: 1rem 1.25rem; }
.latest-title { font-size: 1.125rem; font-weight: 600; margin: 0.5rem 0 0.25rem; line-height: 1.35; color: var(--fg); transition: color 0.15s; }
.latest-excerpt { font-size: 0.875rem; color: var(--muted); margin: 0.25rem 0 0; }

/* Sidebar */
.sidebar-sticky { position: sticky; top: 5rem; }
.sidebar-block { background: var(--card); border: 1px solid var(--border); border-radius: 10px; padding: 0.8rem; }
.sidebar-title { font-size: 1rem; font-weight: 700; color: var(--fg); margin-bottom: 0.75rem; }
.sidebar-list { list-style: none; padding: 0; margin: 0; }
.sidebar-list li { margin: 0.25rem 0; }
.sidebar-list a { color: var(--muted); text-decoration: none; font-size: 0.9375rem; padding: 0.35rem 0; display: block; border-radius: 6px; padding-left: 0.5rem; transition: color 0.15s, background 0.15s; }
.sidebar-list a:hover { color: var(--accent); background: var(--hover); }
.sidebar-list a.active { color: var(--accent); font-weight: 600; }
.sidebar-list-cats a { display: flex; justify-content: space-between; align-items: center; }
.cat-count { font-size: 0.75rem; color: var(--muted); background: var(--bg2); padding: 0.15rem 0.5rem; border-radius: 999px; }
.sidebar-list a.active .cat-count { color: var(--accent); }
.sidebar-article-list { list-style: none; padding: 0; margin: 0; }
.sidebar-article-list li { border-bottom: 1px solid var(--border); padding: 0.5rem 0; }
.sidebar-article-list li:last-child { border-bottom: none; }
.sidebar-article-link { font-size: 0.875rem; color: var(--fg); text-decoration: none; display: block; transition: color 0.15s; }
.sidebar-article-link:hover { color: var(--accent); }
.sidebar-meta { font-size: 0.75rem; color: var(--muted); display: block; margin-top: 0.2rem; }
.sidebar-block { padding-bottom: 0.5rem; }

/* Article body - SEO subheadings */
.article-body p { margin-bottom: 1rem; line-height: 1.7; }
.article-body h2 { font-size: 1.5rem; font-weight: 700; margin-top: 2rem; margin-bottom: 0.75rem; color: var(--fg); line-height: 1.3; }
.article-body h3 { font-size: 1.25rem; font-weight: 600; margin-top: 1.5rem; margin-bottom: 0.5rem; color: var(--fg); }
.article-body strong { font-weight: 600; }
.article-body em { font-style: italic; }
.article-body h2:first-child { margin-top: 0; }
.article-body h3 + p { margin-top: 0; }
.article-inline-img { margin: 1.5rem 0; border-radius: 12px; overflow: hidden; }
.article-inline-img img { width: 100%; height: auto; display: block; }
.article-layout-v2 {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--space-8);
}
@media (min-width: 1024px) {
  .article-layout-v2 {
    grid-template-columns: minmax(0, 1fr) 280px;
    align-items: start;
  }
}
.article-side-card {
  position: sticky;
  top: 5.5rem;
  padding: var(--space-5);
}
.author-card-name { font-weight: 700; margin: 0; }
.author-card-role { margin: 0; color: var(--muted); font-size: .9rem; }
.author-card-bio { margin-top: .5rem; font-size: .9rem; color: var(--fg); line-height: 1.55; }

/* Lazy images - reduce layout shift */
img.lazy { opacity: 0; transition: opacity .25s; }
img.lazy.loaded { opacity: 1; }

/* Inputs & buttons */
.input {
  width: 100%;
  padding: 0.5rem 0.75rem;
  font-size: 1rem;
  border: 1px solid var(--input-border);
  border-radius: 0.5rem;
  background: var(--input-bg);
  color: var(--fg);
}
.btn { display: inline-block; padding: 0.5rem 1rem; border-radius: 0.5rem; font-weight: 500; cursor: pointer; border: none; transition: background .15s; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); }

/* Share bar - article page */
.share-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  margin-top: 2rem;
  padding: 1rem 0;
  border-top: 1px solid var(--border);
}
.share-bar-label {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--muted);
  margin-right: 0.25rem;
}
.share-bar-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 50%;
  font-size: 0.875rem;
  font-weight: 600;
  text-decoration: none;
  color: #fff;
  transition: transform .15s, box-shadow .15s;
}
.share-bar-btn:hover { transform: scale(1.08); box-shadow: 0 4px 12px rgba(0,0,0,.2); }
.share-bar-x { background: #000; color: #fff; }
html.theme-dark .share-bar-x { background: #fff; color: #000; }
.share-bar-linkedin { background: #0a66c2; }
.share-bar-whatsapp { background: #25d366; }
.share-bar-facebook { background: #1877f2; }
.share-bar-telegram { background: #0088cc; }

/* Accessibility helper */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

/* Search overlay */
.search-trigger { font-size: 1.2rem; }
.search-overlay {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(0,0,0,0.5); backdrop-filter: blur(4px);
  display: flex; align-items: flex-start; justify-content: center; padding: 4rem 1rem 1rem;
  opacity: 0; visibility: hidden; transition: opacity .2s, visibility .2s;
}
.search-overlay.is-open { opacity: 1; visibility: visible; }
.search-overlay-inner {
  background: var(--card); border-radius: 16px; padding: 1.5rem; width: 100%; max-width: 560px;
  box-shadow: 0 20px 40px rgba(0,0,0,.15);
}
.search-overlay-close {
  position: absolute; top: 0.75rem; right: 0.75rem;
  background: none; border: none; font-size: 1.5rem; color: var(--muted); cursor: pointer; padding: 0.25rem;
  line-height: 1;
}
.search-overlay-close:hover { color: var(--fg); }
.search-overlay-form { display: flex; gap: 0.5rem; margin-top: 0.5rem; }
.search-overlay-input {
  flex: 1; padding: 0.75rem 1rem; font-size: 1.125rem; border: 2px solid var(--border);
  border-radius: 10px; background: var(--input-bg); color: var(--fg);
}
.search-overlay-input:focus { outline: none; border-color: var(--accent); }
.search-overlay-btn {
  padding: 0.75rem 1.25rem; background: var(--accent); color: #fff; border: none;
  border-radius: 10px; font-weight: 600; cursor: pointer;
}

/* Search page */
.search-page { max-width: 900px; margin: 0 auto; }
.search-page-title { font-size: 1.75rem; font-weight: 700; margin-bottom: 1rem; }
.search-form-inline { display: flex; gap: 0.5rem; margin-bottom: 1.5rem; flex-wrap: wrap; }
.search-form-inline .search-input {
  flex: 1; min-width: 200px; padding: 0.6rem 1rem; font-size: 1rem;
  border: 1px solid var(--border); border-radius: 8px; background: var(--input-bg); color: var(--fg);
}
.search-meta { font-size: 0.9375rem; color: var(--muted); margin-bottom: 1rem; }
.search-no-results { padding: 2rem 0; color: var(--muted); }

/* Pagination */
.pagination { display: flex; flex-wrap: wrap; align-items: center; gap: 0.75rem; margin-top: 2rem; padding: 1rem 0; }
.pagination-btn {
  display: inline-block; padding: 0.5rem 1rem; background: var(--card); border: 1px solid var(--border);
  border-radius: 8px; color: var(--fg); text-decoration: none; font-weight: 500;
}
.pagination-btn:hover { background: var(--hover); border-color: var(--accent); }
.pagination-info { font-size: 0.9375rem; color: var(--muted); }

.hidden { display: none !important; }

/* Header mobile improvements */
.header-container { gap: 0.75rem; }
.header-nav-wrap {
  flex: 1;
  display: flex;
  justify-content: flex-end;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.header-nav {
  white-space: nowrap;
}
@media (max-width: 640px) {
  .site-logo { font-size: 1.1rem; }
  .header-nav-wrap {
    -ms-overflow-style: none;
    scrollbar-width: none;
  }
  .header-nav-wrap::-webkit-scrollbar {
    display: none;
  }
}

/* Breadcrumb */
.breadcrumb { font-size: 0.875rem; color: var(--muted); margin-bottom: 1rem; }
.breadcrumb a { color: var(--accent); text-decoration: none; }
.breadcrumb a:hover { text-decoration: underline; }
.breadcrumb-sep { margin: 0 0.35rem; }

/* Report content */
.report-content-wrap { margin-top: 1.5rem; padding-top: 1rem; border-top: 1px solid var(--border); }
.report-content-btn {
  background: none; border: 1px solid var(--border); color: var(--muted);
  padding: 0.4rem 0.75rem; border-radius: 6px; font-size: 0.875rem; cursor: pointer;
}
.report-content-btn:hover { color: var(--fg); border-color: var(--muted); }
.report-content-form { margin-top: 0.75rem; max-width: 24rem; }
.report-content-msg { margin-top: 0.5rem; font-size: 0.875rem; }

/* Internal link in article body */
.article-body a.internal-link { color: var(--accent); text-decoration: underline; }

.share-btn {
  padding: 0.35rem 0.75rem;
  font-size: 0.875rem;
  background: var(--hover);
  color: var(--fg);
  border-radius: 0.5rem;
  text-decoration: none;
  transition: background .15s;
}
.share-btn:hover { background: var(--border); }

/* Comments */
.comment-card {
  padding: 1rem;
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  background: var(--card);
}

/* Ad stealth - subtle wrapper for policy compliance */
.ad-slot { margin: 1rem 0; }
.ad-stealth .ad-wrapper { min-height: 50px; }
.ad-fallback { position: relative; padding: 0.75rem; background: linear-gradient(180deg, var(--bg2), var(--card)); border: 1px solid var(--border); border-radius: 8px; }
.ad-hide-btn {
  position: absolute;
  top: 0.25rem;
  right: 0.35rem;
  border: none;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
}
.ad-hide-btn:hover { color: var(--fg); }
.ad-fallback-label { font-size: 0.8125rem; font-weight: 700; margin-bottom: 0.5rem; color: var(--accent); text-transform: uppercase; letter-spacing: .04em; }
.ad-fallback-list { list-style: none; padding: 0; margin: 0; }
.ad-fallback-list li { margin: 0.35rem 0; }
.ad-fallback-list a { color: var(--fg); text-decoration: none; }
.ad-fallback-list a:hover { text-decoration: underline; color: var(--accent); }

/* Cookie consent bar - GDPR/AdSense compliant */
.cookie-consent {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 1rem 1.5rem;
  background: var(--card);
  border-top: 1px solid var(--border);
  z-index: 100;
  display: none;
  box-shadow: 0 -4px 20px rgba(0,0,0,.08);
}
.cookie-consent.show { display: block; }
.cookie-consent-inner { max-width: 640px; margin: 0 auto; }
.cookie-consent-text { margin: 0 0 0.75rem 0; font-size: 0.9375rem; }
.cookie-consent-buttons { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.cookie-reject-btn { background: var(--bg2); color: var(--fg); border: 1px solid var(--border); }
.cookie-reject-btn:hover { background: var(--hover); }

/* Theme toggle icons */
#theme-toggle .icon-sun,
#theme-toggle .icon-moon { display: none; }
html.theme-light #theme-toggle .icon-moon { display: inline; }
html.theme-dark #theme-toggle .icon-sun { display: inline; }
html.theme-auto #theme-toggle .icon-moon { display: inline; }

/* Prefer color-scheme for system preference until user toggles */
@media (prefers-color-scheme: dark) {
  html.theme-auto { --bg: #0f0f0f; --bg2: #1a1a1a; --fg: #f5f5f5; --muted: #9ca3af; --border: #2d2d2d; --accent: #3b82f6; --accent-hover: #60a5fa; --hover: rgba(255,255,255,.08); --card: #1a1a1a; --input-bg: #262626; --input-border: #404040; }
  html.theme-auto #theme-toggle .icon-sun { display: inline !important; }
  html.theme-auto #theme-toggle .icon-moon { display: none !important; }
}
