/* ════════════════════════════════════════════════════════════════════
   TechPulse — style.css
   Tech news site: dark header, sidebar layout, ad-ready
   ════════════════════════════════════════════════════════════════════ */

/* ── Utilities ──────────────────────────────────────────────────── */
.sr-only {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}

/* ── Category nav bar ───────────────────────────────────────────── */
.header-cats {
  background: #1a1f2e;
  border-top: 1px solid rgba(255,255,255,.07);
}
.header-cats .wrap {
  display: flex; align-items: center; gap: 0;
  overflow-x: auto; scrollbar-width: none;
}
.header-cats .wrap::-webkit-scrollbar { display: none; }
.header-cats a {
  display: inline-block;
  padding: .55rem 1rem;
  font-size: .82rem; font-weight: 500;
  color: rgba(255,255,255,.65);
  text-decoration: none; white-space: nowrap;
  letter-spacing: .02em; text-transform: uppercase;
  border-bottom: 2px solid transparent;
  transition: color .15s, border-color .15s;
}
.header-cats a:hover { color: #fff; border-bottom-color: var(--accent); }
.header-cats a.active { color: #fff; border-bottom-color: var(--accent); }

/* ── Top banner ad slot ─────────────────────────────────────────── */
.ad-banner-top {
  background: #f1f5f9;
  border-bottom: 1px solid #e2e8f0;
  text-align: center;
  padding: .5rem 0;
  font-size: .75rem; color: #94a3b8;
}

/* ── Site body wrapper ──────────────────────────────────────────── */
.site-body {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 1.75rem 1.25rem;
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 2.25rem;
  align-items: start;
}
@media (max-width: 900px) {
  .site-body { grid-template-columns: 1fr; gap: 1.5rem; }
}
.site-body-full {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 1.75rem 1.25rem;
}

/* ── Sidebar ────────────────────────────────────────────────────── */
.sidebar { position: sticky; top: 4rem; }
.sidebar-widget {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  margin-bottom: 1.5rem;
}
.widget-header {
  background: var(--accent);
  color: #fff;
  font-size: .72rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: .08em;
  padding: .5rem .85rem;
}
.widget-body { padding: .85rem; }

/* Trending widget */
.trending-list { list-style: none; display: flex; flex-direction: column; gap: .6rem; }
.trending-item { display: flex; gap: .65rem; align-items: flex-start; }
.trending-num {
  font-size: 1.25rem; font-weight: 800;
  color: var(--border); line-height: 1.2;
  flex-shrink: 0; width: 1.5rem; text-align: right;
}
.trending-link {
  font-size: .875rem; font-weight: 500; line-height: 1.4;
  color: var(--text); text-decoration: none;
}
.trending-link:hover { color: var(--accent); text-decoration: none; }
.trending-meta { font-size: .75rem; color: var(--muted); margin-top: .1rem; }

/* Category widget */
.cat-widget-list { list-style: none; display: flex; flex-direction: column; }
.cat-widget-item a {
  display: flex; justify-content: space-between; align-items: center;
  padding: .4rem 0;
  border-bottom: 1px solid var(--border);
  font-size: .875rem; color: var(--text); text-decoration: none;
  transition: color .15s;
}
.cat-widget-item:last-child a { border-bottom: none; }
.cat-widget-item a:hover { color: var(--accent); text-decoration: none; }
.cat-count { font-size: .75rem; color: var(--muted); }

/* Ad widget */
.ad-slot { text-align: center; }
.ad-slot-label {
  font-size: .65rem; text-transform: uppercase; letter-spacing: .06em;
  color: var(--muted); margin-bottom: .35rem; display: block;
}

/* ── Buttons ────────────────────────────────────────────────────── */
.btn {
  display: inline-block; padding: .5rem 1.25rem;
  background: var(--accent); color: #fff;
  border-radius: 5px; font-size: .9rem; font-weight: 600;
  text-decoration: none; transition: opacity .15s;
  border: none; cursor: pointer;
}
.btn:hover { opacity: .85; text-decoration: none; }
.btn-outline {
  background: transparent; color: var(--accent);
  border: 1.5px solid var(--accent);
}
.btn-outline:hover { background: var(--accent); color: #fff; }

/* ── Tags ───────────────────────────────────────────────────────── */
.tag {
  display: inline-block; padding: .2rem .55rem;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 3px; font-size: .78rem;
  color: var(--muted); text-decoration: none;
  transition: background .15s;
}
.tag:hover { background: var(--accent); border-color: var(--accent); color: #fff; text-decoration: none; }
.tag--active { background: var(--accent); color: #fff !important; border-color: var(--accent); }

/* ── Featured article (homepage hero) ──────────────────────────── */
.featured-post {
  position: relative;
  border-radius: 12px; overflow: hidden;
  margin-bottom: 2rem;
  background: #0d1117;
}
.featured-post img {
  width: 100%; height: 420px; object-fit: cover;
  display: block; opacity: .75;
  transition: opacity .3s, transform .4s;
}
.featured-post:hover img { opacity: .85; transform: scale(1.02); }
.featured-overlay {
  position: absolute; bottom: 0; left: 0; right: 0;
  background: linear-gradient(to top, rgba(0,0,0,.88) 0%, rgba(0,0,0,.4) 60%, transparent 100%);
  padding: 2rem 1.75rem 1.5rem;
}
.featured-category {
  display: inline-block;
  background: var(--accent); color: #fff;
  font-size: .72rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: .07em;
  padding: .2rem .55rem; border-radius: 3px;
  text-decoration: none; margin-bottom: .6rem;
}
.featured-title {
  font-size: clamp(1.3rem, 3.5vw, 2rem);
  font-weight: 800; line-height: 1.2; color: #fff;
  margin-bottom: .65rem;
}
.featured-title a { color: inherit; text-decoration: none; }
.featured-title a:hover { text-decoration: underline; }
.featured-meta { font-size: .82rem; color: rgba(255,255,255,.65); }

/* Featured fallback (no image) */
.featured-post--text {
  background: linear-gradient(135deg, #0d1117 0%, #1a2332 100%);
  padding: 2.5rem 2rem;
  border-radius: 12px; margin-bottom: 2rem;
}
.featured-post--text .featured-overlay { position: static; background: none; padding: 0; }
.featured-post--text .featured-title { font-size: clamp(1.4rem, 3vw, 2.2rem); }
.featured-post--text .featured-meta { color: rgba(255,255,255,.55); }

/* ── Section headers ────────────────────────────────────────────── */
.section-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 1.1rem; padding-bottom: .6rem;
  border-bottom: 2px solid var(--border);
}
.section-head-title {
  font-size: 1rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: .06em;
  color: var(--text);
  display: flex; align-items: center; gap: .5rem;
}
.section-head-title::before {
  content: ''; display: inline-block;
  width: 3px; height: 1em; background: var(--accent);
  border-radius: 2px;
}
.section-head-link { font-size: .82rem; color: var(--muted); }
.section-head-link:hover { color: var(--accent); }

/* ── Post grid ──────────────────────────────────────────────────── */
.post-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.5rem;
}
@media (max-width: 640px) {
  .post-grid { grid-template-columns: 1fr; gap: 1.25rem; }
}

.post-card {
  border: 1px solid var(--border);
  border-radius: 10px; overflow: hidden;
  background: var(--surface);
  display: flex; flex-direction: column;
  transition: box-shadow .2s, transform .15s;
}
.post-card:hover {
  box-shadow: 0 4px 24px rgba(0,0,0,.08);
  transform: translateY(-2px);
}
.card-img-link { display: block; overflow: hidden; aspect-ratio: 16/9; }
.card-img-link img {
  width: 100%; height: 100%; object-fit: cover;
  transition: transform .35s;
}
.post-card:hover .card-img-link img { transform: scale(1.05); }
.card-img-placeholder {
  display: block; aspect-ratio: 16/9;
  background: linear-gradient(135deg, #1e293b, #334155);
}

.card-body { padding: .9rem 1rem 1rem; display: flex; flex-direction: column; flex: 1; }
.card-category {
  font-size: .72rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: .07em;
  color: var(--accent); margin-bottom: .3rem;
  text-decoration: none;
}
.card-category:hover { text-decoration: underline; }
.card-title { font-size: .975rem; font-weight: 700; line-height: 1.35; margin-bottom: .4rem; }
.card-title a { color: var(--text); text-decoration: none; }
.card-title a:hover { color: var(--accent); }
.card-excerpt {
  font-size: .85rem; color: var(--muted); line-height: 1.5;
  flex: 1; margin-bottom: .6rem;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.card-meta {
  display: flex; flex-wrap: wrap; align-items: center; gap: .35rem;
  font-size: .78rem; color: var(--muted); margin-top: auto;
}
.card-tags { display: flex; flex-wrap: wrap; gap: .2rem; }

/* Compact list card (sidebar / related) */
.post-card-compact {
  display: flex; gap: .65rem; align-items: flex-start;
  padding-bottom: .75rem; margin-bottom: .75rem;
  border-bottom: 1px solid var(--border);
}
.post-card-compact:last-child { border-bottom: none; padding-bottom: 0; margin-bottom: 0; }
.compact-img {
  width: 68px; height: 52px; border-radius: 5px;
  object-fit: cover; flex-shrink: 0; display: block;
}
.compact-body { flex: 1; min-width: 0; }
.compact-title {
  font-size: .85rem; font-weight: 600; line-height: 1.35;
  color: var(--text); text-decoration: none;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.compact-title:hover { color: var(--accent); text-decoration: none; }
.compact-meta { font-size: .73rem; color: var(--muted); margin-top: .15rem; }

/* In-feed ad */
.infeed-ad {
  grid-column: 1 / -1;
  text-align: center;
  padding: .5rem 0;
}

/* ── Post list (search / tag / category list view) ──────────────── */
.post-list { display: flex; flex-direction: column; gap: 1.25rem; }
.post-row {
  display: flex; gap: 1rem; align-items: flex-start;
  padding-bottom: 1.25rem; border-bottom: 1px solid var(--border);
}
.post-row:last-child { border-bottom: none; }
.post-row-img {
  width: 120px; height: 80px; border-radius: 7px;
  object-fit: cover; flex-shrink: 0; display: block;
}
.post-row-body { flex: 1; min-width: 0; }
.post-row-cat { font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--accent); text-decoration: none; }
.post-row-cat:hover { text-decoration: underline; }
.post-row-title { font-size: 1rem; font-weight: 700; line-height: 1.35; margin: .15rem 0 .35rem; }
.post-row-title a { color: var(--text); text-decoration: none; }
.post-row-title a:hover { color: var(--accent); }
.post-row-excerpt {
  font-size: .85rem; color: var(--muted); line-height: 1.45;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
  margin-bottom: .35rem;
}
.post-row-meta { font-size: .78rem; color: var(--muted); }

/* ── Article page ───────────────────────────────────────────────── */
.article-wrap { max-width: 720px; }

.article-header { margin-bottom: 1.25rem; }
.article-category {
  font-size: .72rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: .07em;
  color: var(--accent); text-decoration: none;
  display: inline-block; margin-bottom: .4rem;
}
.article-category:hover { text-decoration: underline; }

.article-title {
  font-size: clamp(1.5rem, 4vw, 2.3rem);
  font-weight: 800; line-height: 1.2;
  margin: .3rem 0 .9rem;
}
.article-excerpt {
  font-size: 1.1rem; color: var(--muted);
  line-height: 1.55; margin-bottom: 1rem;
  font-weight: 400;
}
.article-meta {
  display: flex; flex-wrap: wrap; gap: .5rem .9rem;
  font-size: .85rem; color: var(--muted);
  padding: .85rem 0; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border);
  margin-bottom: 1rem;
}
.meta-author { font-weight: 600; color: var(--text); }
.article-tags { display: flex; flex-wrap: wrap; gap: .35rem; margin-top: .65rem; }

.article-cover { margin: 1rem 0 1.5rem; border-radius: 10px; overflow: hidden; }
.article-cover img { width: 100%; border-radius: 10px; display: block; }

/* Article body typography */
.article-body { font-size: 1.05rem; line-height: 1.75; color: var(--text); }
.article-body h2 { font-size: 1.45rem; font-weight: 800; margin: 2rem 0 .65rem; line-height: 1.25; }
.article-body h3 { font-size: 1.15rem; font-weight: 700; margin: 1.5rem 0 .5rem; }
.article-body h4 { font-size: 1rem; font-weight: 700; margin: 1.25rem 0 .4rem; }
.article-body p { margin-bottom: 1.3rem; }
.article-body ul, .article-body ol { margin: 0 0 1.25rem 1.5rem; }
.article-body li { margin-bottom: .4rem; }
.article-body blockquote {
  border-left: 4px solid var(--accent);
  padding: .75rem 1.25rem; margin: 1.5rem 0;
  color: var(--muted); font-style: italic;
  background: var(--surface); border-radius: 0 6px 6px 0;
  font-size: 1.05rem;
}
.article-body pre {
  background: #0d1117; border: 1px solid #30363d;
  border-radius: 8px; padding: 1.1rem 1.25rem;
  overflow-x: auto; margin-bottom: 1.25rem;
  font-size: .9rem; line-height: 1.55; color: #e6edf3;
}
.article-body code {
  background: var(--surface); padding: .15em .4em;
  border-radius: 3px; font-size: .9em;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  color: var(--accent);
}
.article-body pre code { background: none; padding: 0; font-size: inherit; color: inherit; }
.article-body img { border-radius: 8px; margin: 1.25rem 0; width: 100%; }
.article-body table { width: 100%; border-collapse: collapse; margin-bottom: 1.25rem; }
.article-body th, .article-body td { border: 1px solid var(--border); padding: .5rem .75rem; text-align: left; }
.article-body th { background: var(--surface); font-weight: 700; }
.article-body a { color: var(--accent); text-decoration: underline; }
.article-body hr { border: none; border-top: 1px solid var(--border); margin: 2rem 0; }

/* Article ad slots */
.ad-article { margin: 1.75rem 0; text-align: center; }

/* Article TOC */
.article-toc {
  margin: 1.25rem 0; padding: 1rem 1.25rem;
  background: var(--surface); border-radius: 8px;
  border-left: 3px solid var(--accent); font-size: .9rem;
}
.toc-title {
  display: block; margin-bottom: .5rem;
  font-size: .78rem; text-transform: uppercase;
  letter-spacing: .06em; color: var(--muted); font-weight: 700;
}
.article-toc ol { margin: 0; padding-left: 1.25rem; }
.article-toc li { margin-bottom: .25rem; }
.article-sections { display: none; }
.article-footer { margin-top: 1.75rem; padding-top: 1.25rem; padding-bottom: 1.25rem; border-top: 1px solid var(--border); }
.article-tags-footer { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem; }

/* ── Related posts ──────────────────────────────────────────────── */
.related-posts { margin-top: 2.5rem; padding-top: 1.75rem; border-top: 2px solid var(--border); }
.related-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1rem; margin-top: 1rem;
}
.related-card {
  display: flex; flex-direction: column;
  border: 1px solid var(--border); border-radius: 8px;
  overflow: hidden; text-decoration: none; color: inherit;
  transition: box-shadow .2s, transform .15s;
}
.related-card:hover { box-shadow: 0 4px 16px rgba(0,0,0,.1); transform: translateY(-2px); }
.related-card img { width: 100%; height: 130px; object-fit: cover; display: block; }
.related-card-body { padding: .7rem .8rem; flex: 1; }
.related-card-title { font-size: .875rem; font-weight: 700; line-height: 1.35; margin-bottom: .25rem; }
.related-card-excerpt { font-size: .78rem; color: var(--muted); line-height: 1.4; }

/* ── Breadcrumbs ────────────────────────────────────────────────── */
.breadcrumbs { margin-bottom: 1rem; }
.breadcrumbs ol {
  list-style: none; display: flex; flex-wrap: wrap;
  gap: .25rem; align-items: center;
  font-size: .82rem; color: var(--muted);
}
.breadcrumbs li + li::before { content: "›"; margin-right: .25rem; color: var(--border); }
.breadcrumbs a { color: var(--muted); }
.breadcrumbs a:hover { color: var(--accent); }
.breadcrumbs [aria-current="page"] { color: var(--text); font-weight: 500; }

/* ── Pagination ─────────────────────────────────────────────────── */
.pagination {
  display: flex; justify-content: center; align-items: center;
  flex-wrap: wrap; gap: .35rem; margin: 2rem 0 .5rem;
}
.page-numbers { display: flex; gap: .3rem; align-items: center; }
.page-link {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 2.1rem; height: 2.1rem; padding: 0 .55rem;
  border: 1px solid var(--border); border-radius: 5px;
  font-size: .875rem; color: var(--text); text-decoration: none;
  transition: background .15s, border-color .15s, color .15s;
}
.page-link:hover { background: var(--accent); border-color: var(--accent); color: #fff; text-decoration: none; }
.page-link.page-current { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 700; }
.page-link.disabled { opacity: .4; cursor: not-allowed; pointer-events: none; }
.page-ellipsis { color: var(--muted); padding: 0 .25rem; }

/* ── Page hero / headings ───────────────────────────────────────── */
.page-hero {
  padding: 0 0 1.25rem; margin-bottom: 1.5rem;
  border-bottom: 2px solid var(--border);
}
.page-title { font-size: clamp(1.5rem, 4vw, 2.1rem); font-weight: 800; line-height: 1.2; }
.page-subtitle { color: var(--muted); margin-top: .4rem; font-size: .95rem; }

/* ── Search page ────────────────────────────────────────────────── */
.search-form-full { display: flex; gap: .5rem; margin: 1.25rem 0; }
.search-form-full input {
  flex: 1; padding: .6rem 1rem;
  border: 1px solid var(--border); border-radius: 6px;
  font-size: 1rem; background: var(--surface); color: var(--text);
}
.search-form-full input:focus { outline: 2px solid var(--accent); border-color: transparent; }
.search-summary { color: var(--muted); margin-bottom: 1.25rem; font-size: .9rem; }
.search-snippet { font-size: .875rem; color: var(--muted); margin: .3rem 0 .5rem; }
.search-snippet mark { background: rgba(var(--accent-rgb), .12); color: var(--accent); border-radius: 2px; }

/* ── Empty state ────────────────────────────────────────────────── */
.empty-state { text-align: center; padding: 4rem 0; color: var(--muted); }
.empty-state .btn { margin-top: 1rem; }

/* ── 404 / error page ───────────────────────────────────────────── */
.error-page { text-align: center; padding: 5rem 0 3rem; }
.error-code {
  font-size: 7rem; font-weight: 900; line-height: 1;
  background: linear-gradient(135deg, var(--accent), #f97316);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
}
.error-title { font-size: 1.75rem; font-weight: 800; margin: .5rem 0 .75rem; }
.error-desc { color: var(--muted); margin-bottom: 2rem; max-width: 34rem; margin-left: auto; margin-right: auto; }
.error-actions { display: flex; gap: .75rem; justify-content: center; flex-wrap: wrap; }

/* ── Footer ─────────────────────────────────────────────────────── */
.footer-grid {
  display: grid; grid-template-columns: 2fr 1fr 1fr 1fr; gap: 2rem;
  padding: 2.5rem 0; border-bottom: 1px solid rgba(255,255,255,.08);
}
@media (max-width: 800px) { .footer-grid { grid-template-columns: 1fr 1fr; } }
@media (max-width: 500px) { .footer-grid { grid-template-columns: 1fr; gap: 1.5rem; } }
.footer-col-title {
  font-size: .75rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: .08em;
  color: rgba(255,255,255,.5); margin-bottom: .75rem;
}
.footer-desc { font-size: .875rem; color: rgba(255,255,255,.5); line-height: 1.6; }
.footer-logo { font-size: 1.3rem; font-weight: 800; color: #fff; margin-bottom: .5rem; display: block; text-decoration: none; }
.footer-col-links { list-style: none; display: flex; flex-direction: column; gap: .4rem; }
.footer-col-links a { font-size: .875rem; color: rgba(255,255,255,.55); text-decoration: none; }
.footer-col-links a:hover { color: #fff; text-decoration: none; }
.footer-bottom {
  padding: 1.25rem 0; display: flex; flex-wrap: wrap;
  justify-content: space-between; align-items: center; gap: .5rem;
  font-size: .8rem; color: rgba(255,255,255,.35);
}
.footer-bottom a { color: rgba(255,255,255,.45); text-decoration: none; }
.footer-bottom a:hover { color: rgba(255,255,255,.8); }
.footer-bottom-links { display: flex; gap: 1.25rem; flex-wrap: wrap; }

/* ── Static pages (about, contacts, privacy, terms) ────────────── */
.static-page { max-width: 720px; }
.static-page .article-body h2 { font-size: 1.3rem; margin-top: 2rem; }
.static-page .article-body p { margin-bottom: 1.1rem; }

/* ── Language switcher (legacy) ─────────────────────────────────── */
.lang-switcher { display: flex; gap: .35rem; margin-bottom: 1rem; }
.lang-btn {
  padding: .25rem .65rem; font-size: .8rem; font-weight: 600;
  border: 1px solid var(--border); border-radius: 4px;
  background: var(--surface); color: var(--muted);
  cursor: pointer; transition: background .15s, color .15s, border-color .15s;
}
.lang-btn:hover { border-color: var(--accent); color: var(--accent); }
.lang-btn--active { background: var(--accent); color: #fff; border-color: var(--accent); }

/* ── Category pills (compact) ───────────────────────────────────── */
.cat-pills { display: flex; flex-wrap: wrap; gap: .4rem; margin-bottom: 1.25rem; }
.cat-pill {
  display: inline-flex; align-items: center; gap: .25rem;
  padding: .22rem .65rem; background: var(--surface);
  border: 1px solid var(--border); border-radius: 999px;
  font-size: .8rem; color: var(--text); text-decoration: none;
  transition: background .15s, border-color .15s;
}
.cat-pill:hover { background: var(--accent); border-color: var(--accent); color: #fff; text-decoration: none; }
.cat-count { color: var(--muted); font-size: .72rem; }
.cat-pill:hover .cat-count { color: rgba(255,255,255,.75); }

/* ── Breaking/ticker strip ──────────────────────────────────────── */
.ticker-bar {
  background: var(--accent); color: #fff;
  padding: .35rem 0; font-size: .82rem;
  overflow: hidden; white-space: nowrap;
}
.ticker-label {
  display: inline-block; background: rgba(0,0,0,.25);
  padding: .05rem .6rem; font-weight: 700;
  letter-spacing: .05em; text-transform: uppercase; margin-right: .75rem;
  font-size: .72rem;
}
