/*
Theme Name: TraceScope Blog
Theme URI: https://tracescope.org/blog/
Author: TraceScope
Description: Content-first bilingual WordPress theme for TraceScope browser fingerprint research.
Version: 1.0.0
Text Domain: tracescope-blog
*/

:root {
  color-scheme: dark;
  --ts-bg: #020617;
  --ts-bg-deep: #040a18;
  --ts-surface: rgba(15, 23, 42, 0.78);
  --ts-surface-strong: rgba(15, 23, 42, 0.94);
  --ts-surface-soft: rgba(30, 41, 59, 0.56);
  --ts-text: #f8fafc;
  --ts-muted: #b2bfd1;
  --ts-subtle: #8fa3bd;
  --ts-line: rgba(148, 163, 184, 0.22);
  --ts-line-strong: rgba(148, 163, 184, 0.34);
  --ts-cyan: #22d3ee;
  --ts-green: #22c55e;
  --ts-blue: #60a5fa;
  --ts-amber: #f59e0b;
  --ts-red: #fb7185;
  --ts-radius: 14px;
  --ts-shadow: 0 24px 80px rgba(0, 0, 0, 0.34);
  --ts-font-cjk: "Noto Sans SC", "Noto Sans CJK SC", "Microsoft YaHei UI", "Microsoft YaHei", "PingFang SC", "Hiragino Sans GB", "Source Han Sans SC", system-ui, sans-serif;
  --ts-font-sans: "Segoe UI Variable Text", Inter, "Noto Sans SC", "Microsoft YaHei UI", "Microsoft YaHei", "PingFang SC", system-ui, sans-serif;
  --ts-font-display: "Segoe UI Variable Display", "Segoe UI Variable Text", Inter, "Noto Sans SC", "Microsoft YaHei UI", system-ui, sans-serif;
  --ts-font-mono: "Cascadia Code", "Cascadia Mono", "SFMono-Regular", "Roboto Mono", "Fira Code", Consolas, monospace;
}

* { box-sizing: border-box; }

html {
  background: var(--ts-bg);
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-width: 320px;
  color: var(--ts-text);
  background:
    radial-gradient(circle at 14% 8%, rgba(34, 211, 238, 0.18), transparent 30rem),
    radial-gradient(circle at 84% 0%, rgba(96, 165, 250, 0.2), transparent 34rem),
    radial-gradient(circle at 50% 74%, rgba(34, 197, 94, 0.08), transparent 34rem),
    linear-gradient(180deg, #020617 0%, #061126 46%, #020617 100%);
  font-family: var(--ts-font-sans);
  font-size: 16px;
  line-height: 1.6;
  overflow-x: clip;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-synthesis: none;
}

html[lang="zh-CN"] body { font-family: var(--ts-font-cjk); }

body::before {
  position: fixed;
  z-index: -1;
  inset: 0;
  content: "";
  pointer-events: none;
  background:
    linear-gradient(rgba(148, 163, 184, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(148, 163, 184, 0.04) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.72), transparent 78%);
}

a { color: inherit; }

a:focus-visible,
button:focus-visible,
summary:focus-visible,
input:focus-visible,
textarea:focus-visible {
  outline: 2px solid rgba(34, 211, 238, 0.95);
  outline-offset: 3px;
}

button,
input,
textarea,
select { font: inherit; }

.ts-blog-shell {
  width: min(1180px, calc(100% - 40px));
  margin: 0 auto;
}

.screen-reader-text {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.screen-reader-text:focus {
  z-index: 1000;
  top: 12px;
  left: 12px;
  width: auto;
  height: auto;
  padding: 10px 14px;
  margin: 0;
  clip: auto;
  color: #042f2e;
  background: #99f6e4;
  border-radius: 8px;
}

.ts-blog-header {
  position: sticky;
  z-index: 40;
  top: 0;
  border-bottom: 1px solid rgba(148, 163, 184, 0.15);
  background: rgba(2, 6, 23, 0.82);
  backdrop-filter: blur(20px);
}

.ts-blog-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 78px;
  gap: 18px;
}

.ts-blog-brand {
  display: inline-flex;
  align-items: center;
  min-width: 0;
  gap: 12px;
  color: var(--ts-text);
  text-decoration: none;
}

.ts-blog-brand img {
  width: 46px;
  height: 46px;
  flex: 0 0 auto;
}

.ts-blog-header-brand img {
  width: 168px;
  height: auto;
  aspect-ratio: 284 / 82;
  object-fit: contain;
}

.ts-blog-brand strong,
.ts-blog-hero h1,
.ts-blog-post h1,
.ts-blog-card h2,
.ts-blog-section-title,
.ts-blog-empty h2,
.ts-blog-404 h1 {
  font-family: var(--ts-font-display);
  font-weight: 750;
  letter-spacing: 0;
}

html[lang="zh-CN"] .ts-blog-brand strong,
html[lang="zh-CN"] .ts-blog-hero h1,
html[lang="zh-CN"] .ts-blog-post h1,
html[lang="zh-CN"] .ts-blog-card h2,
html[lang="zh-CN"] .ts-blog-section-title,
html[lang="zh-CN"] .ts-blog-empty h2,
html[lang="zh-CN"] .ts-blog-404 h1 { font-family: var(--ts-font-cjk); }

.ts-blog-brand strong {
  display: block;
  font-size: 1.34rem;
  line-height: 1;
}

.ts-blog-brand small {
  display: block;
  margin-top: 2px;
  color: var(--ts-muted);
  font-size: 0.76rem;
  font-weight: 760;
  line-height: 1.2;
}

.ts-blog-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 5px;
}

.ts-blog-actions > a,
.ts-blog-actions summary,
.ts-blog-menu a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 0 12px;
  color: #dbeafe;
  font-weight: 760;
  text-decoration: none;
  border: 1px solid transparent;
  border-radius: 11px;
  cursor: pointer;
  transition: color 160ms ease, border-color 160ms ease, background 160ms ease, transform 160ms ease;
}

.ts-blog-actions > a:hover,
.ts-blog-actions summary:hover,
.ts-blog-menu a:hover {
  color: #f8fafc;
  border-color: rgba(94, 234, 212, 0.32);
  background: rgba(34, 211, 238, 0.1);
  transform: translateY(-1px);
}

.ts-blog-actions details { position: relative; }

.ts-blog-actions summary {
  list-style: none;
  user-select: none;
}

.ts-blog-actions summary::-webkit-details-marker { display: none; }

.ts-blog-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  display: grid;
  min-width: 184px;
  padding: 7px;
  border: 1px solid rgba(96, 165, 250, 0.28);
  border-radius: 12px;
  background: rgba(8, 18, 38, 0.97);
  box-shadow: var(--ts-shadow);
}

.ts-blog-menu a {
  justify-content: flex-start;
  min-height: 39px;
  padding: 0 12px;
  border-radius: 8px;
}

.ts-blog-menu a[aria-current="page"] {
  color: #e0f2fe;
  background: rgba(96, 165, 250, 0.2);
}

.ts-blog-context {
  border-bottom: 1px solid rgba(148, 163, 184, 0.11);
  background: rgba(2, 6, 23, 0.34);
}

.ts-blog-breadcrumb {
  display: flex;
  align-items: center;
  min-height: 46px;
  gap: 8px;
  overflow: hidden;
  color: var(--ts-subtle);
  font-size: 0.86rem;
  white-space: nowrap;
}

.ts-blog-breadcrumb a {
  color: var(--ts-muted);
  text-decoration: none;
}

.ts-blog-breadcrumb a:hover { color: var(--ts-cyan); }

.ts-blog-breadcrumb span:last-child {
  overflow: hidden;
  color: #d8e5f8;
  text-overflow: ellipsis;
}

.ts-blog-main { padding: 40px 0 96px; }

.ts-blog-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 28px;
  padding: clamp(26px, 5vw, 52px);
  border: 1px solid rgba(125, 211, 252, 0.22);
  border-radius: var(--ts-radius);
  background:
    linear-gradient(120deg, rgba(8, 47, 73, 0.56), rgba(15, 23, 42, 0.84) 50%, rgba(49, 46, 129, 0.34)),
    var(--ts-surface-strong);
  box-shadow: var(--ts-shadow);
}

.ts-blog-kicker,
.ts-blog-language-chip,
.ts-blog-status,
.ts-blog-category,
.ts-blog-count {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  min-height: 28px;
  padding: 0 10px;
  border: 1px solid rgba(45, 212, 191, 0.4);
  border-radius: 999px;
  color: #99f6e4;
  background: rgba(13, 148, 136, 0.12);
  font-size: 0.76rem;
  font-weight: 800;
}

.ts-blog-hero h1 {
  max-width: 760px;
  margin: 12px 0 10px;
  font-size: clamp(2.2rem, 5vw, 4.25rem);
  line-height: 1.02;
}

.ts-blog-hero p {
  max-width: 720px;
  margin: 0;
  color: var(--ts-muted);
  font-size: 1.05rem;
}

.ts-blog-hero-meta {
  display: grid;
  min-width: 170px;
  gap: 7px;
  padding: 16px;
  border: 1px solid var(--ts-line);
  border-radius: 12px;
  background: rgba(2, 6, 23, 0.38);
}

.ts-blog-hero-meta span {
  color: var(--ts-subtle);
  font-size: 0.78rem;
  font-weight: 750;
}

.ts-blog-hero-meta strong {
  color: #e0f2fe;
  font-family: var(--ts-font-mono);
  font-size: 1.1rem;
}

.ts-blog-content-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(230px, 0.3fr);
  gap: 24px;
  margin-top: 24px;
}

.ts-blog-list-panel,
.ts-blog-sidebar-card,
.ts-blog-post,
.ts-blog-empty,
.ts-blog-404 {
  border: 1px solid var(--ts-line);
  border-radius: var(--ts-radius);
  background: var(--ts-surface);
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.14);
}

.ts-blog-list-panel { padding: 8px 22px; }

.ts-blog-list-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 14px 0;
  border-bottom: 1px solid var(--ts-line);
}

.ts-blog-section-title {
  margin: 0;
  font-size: 1.08rem;
}

.ts-blog-count {
  color: #bae6fd;
  border-color: rgba(96, 165, 250, 0.38);
  background: rgba(59, 130, 246, 0.12);
}

.ts-blog-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 18px;
  padding: 24px 0;
  border-bottom: 1px solid var(--ts-line);
}

.ts-blog-card:last-of-type { border-bottom: 0; }

.ts-blog-card h2 {
  margin: 10px 0 8px;
  font-size: clamp(1.15rem, 2vw, 1.55rem);
  line-height: 1.22;
}

.ts-blog-card h2 a { text-decoration: none; }
.ts-blog-card h2 a:hover { color: #a5f3fc; }

.ts-blog-card p {
  margin: 0;
  color: var(--ts-muted);
}

.ts-blog-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  color: var(--ts-subtle);
  font-size: 0.82rem;
}

.ts-blog-category {
  color: #bae6fd;
  border-color: rgba(96, 165, 250, 0.32);
  background: rgba(59, 130, 246, 0.12);
}

.ts-blog-card-arrow,
.ts-blog-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 42px;
  height: 42px;
  color: #cffafe;
  border: 1px solid rgba(34, 211, 238, 0.34);
  border-radius: 10px;
  background: rgba(8, 47, 73, 0.32);
  text-decoration: none;
  transition: transform 160ms ease, border-color 160ms ease, background 160ms ease;
}

.ts-blog-card-arrow:hover,
.ts-blog-button:hover {
  border-color: rgba(103, 232, 249, 0.76);
  background: rgba(6, 182, 212, 0.16);
  transform: translateX(2px);
}

.ts-blog-sidebar {
  display: grid;
  align-content: start;
  gap: 16px;
}

.ts-blog-sidebar-card { padding: 19px; }

.ts-blog-sidebar-card h2 {
  margin: 0 0 8px;
  font-family: var(--ts-font-display);
  font-size: 1rem;
}

.ts-blog-sidebar-card p {
  margin: 0;
  color: var(--ts-muted);
  font-size: 0.92rem;
}

.ts-blog-sidebar-card ul {
  display: grid;
  gap: 8px;
  padding: 0;
  margin: 14px 0 0;
  list-style: none;
}

.ts-blog-sidebar-card li a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 38px;
  padding: 0 10px;
  color: #dbeafe;
  border: 1px solid transparent;
  border-radius: 8px;
  text-decoration: none;
}

.ts-blog-sidebar-card li a:hover {
  color: #ecfeff;
  border-color: rgba(34, 211, 238, 0.22);
  background: rgba(34, 211, 238, 0.08);
}

.ts-blog-empty,
.ts-blog-404 {
  padding: clamp(30px, 6vw, 72px);
  text-align: center;
}

.ts-blog-empty h2,
.ts-blog-404 h1 { margin: 0 0 10px; }
.ts-blog-empty p,
.ts-blog-404 p { max-width: 560px; margin: 0 auto; color: var(--ts-muted); }

.ts-blog-empty .ts-blog-button,
.ts-blog-404 .ts-blog-button {
  margin-top: 22px;
  padding: 0 15px;
  transform: none;
}

.ts-blog-pagination {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  padding: 20px 0;
}

.ts-blog-pagination .page-numbers {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 38px;
  height: 38px;
  padding: 0 10px;
  color: #dbeafe;
  border: 1px solid var(--ts-line);
  border-radius: 8px;
  text-decoration: none;
}

.ts-blog-pagination .current {
  color: #ecfeff;
  border-color: rgba(34, 211, 238, 0.52);
  background: rgba(34, 211, 238, 0.14);
}

.ts-blog-post {
  padding: clamp(26px, 5vw, 58px);
}

.ts-blog-post-header {
  max-width: 850px;
  padding-bottom: 26px;
  margin-bottom: 30px;
  border-bottom: 1px solid var(--ts-line);
}

.ts-blog-post h1 {
  margin: 12px 0;
  font-size: clamp(2rem, 5vw, 3.6rem);
  line-height: 1.09;
}

.ts-blog-post-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 9px 14px;
  color: var(--ts-subtle);
  font-size: 0.88rem;
}

.ts-blog-prose {
  max-width: 820px;
  color: #dbeafe;
  font-size: 1.04rem;
}

.ts-blog-prose > *:first-child { margin-top: 0; }
.ts-blog-prose > *:last-child { margin-bottom: 0; }
.ts-blog-prose h2,
.ts-blog-prose h3,
.ts-blog-prose h4 { color: #f8fafc; line-height: 1.25; }
.ts-blog-prose h2 { margin-top: 2.25em; font-size: 1.7rem; }
.ts-blog-prose h3 { margin-top: 1.8em; font-size: 1.28rem; }
.ts-blog-prose p,
.ts-blog-prose ul,
.ts-blog-prose ol { margin: 1.1em 0; }
.ts-blog-prose a { color: #67e8f9; text-underline-offset: 3px; }
.ts-blog-prose blockquote {
  margin: 1.5em 0;
  padding: 14px 18px;
  color: #d9f99d;
  border-left: 3px solid #84cc16;
  border-radius: 0 10px 10px 0;
  background: rgba(132, 204, 22, 0.08);
}
.ts-blog-prose pre,
.ts-blog-prose code { font-family: var(--ts-font-mono); }
.ts-blog-prose pre {
  overflow-x: auto;
  padding: 16px;
  border: 1px solid var(--ts-line);
  border-radius: 10px;
  background: #020617;
}
.ts-blog-prose :not(pre) > code {
  padding: 0.14em 0.35em;
  color: #a5f3fc;
  border-radius: 5px;
  background: rgba(34, 211, 238, 0.12);
}
.ts-blog-prose img {
  max-width: 100%;
  height: auto;
  border: 1px solid var(--ts-line);
  border-radius: 10px;
}
.ts-blog-prose table {
  width: 100%;
  border-collapse: collapse;
  overflow: hidden;
  border: 1px solid var(--ts-line);
  border-radius: 10px;
}
.ts-blog-prose th,
.ts-blog-prose td { padding: 10px; border-bottom: 1px solid var(--ts-line); text-align: left; }
.ts-blog-prose th { color: #e0f2fe; background: rgba(30, 41, 59, 0.68); }

.ts-blog-post-footer {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  padding-top: 30px;
  margin-top: 34px;
  border-top: 1px solid var(--ts-line);
}

.ts-blog-footer {
  border-top: 1px solid rgba(148, 163, 184, 0.18);
  background: rgba(2, 6, 23, 0.75);
}

.ts-blog-footer-grid {
  display: grid;
  grid-template-columns: minmax(220px, 1.4fr) repeat(2, minmax(160px, 0.7fr));
  gap: 36px;
  padding: 48px 0 32px;
}

.ts-blog-footer-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--ts-text);
  text-decoration: none;
}

.ts-blog-footer-brand img { width: 168px; height: auto; aspect-ratio: 284 / 82; object-fit: contain; }
.ts-blog-footer-brand strong { font-family: var(--ts-font-display); font-size: 1.05rem; }
.ts-blog-footer p { max-width: 390px; color: var(--ts-muted); font-size: 0.92rem; }
.ts-blog-footer h2 { margin: 0 0 12px; font-family: var(--ts-font-display); font-size: 0.96rem; }
.ts-blog-footer ul { display: grid; gap: 8px; padding: 0; margin: 0; list-style: none; }
.ts-blog-footer li a { color: #93c5fd; font-size: 0.9rem; text-decoration: none; }
.ts-blog-footer li a:hover { color: #67e8f9; }

.ts-blog-footer-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 70px;
  border-top: 1px solid var(--ts-line);
  color: var(--ts-subtle);
  font-size: 0.82rem;
}

.ts-blog-footer-bottom a { color: #93c5fd; text-decoration: none; }
.ts-blog-footer-bottom a:hover { color: #67e8f9; }

.ts-blog-cookie {
  position: fixed;
  z-index: 60;
  right: 20px;
  bottom: 20px;
  display: flex;
  align-items: center;
  max-width: min(620px, calc(100vw - 40px));
  gap: 14px;
  padding: 14px 16px;
  border: 1px solid rgba(34, 211, 238, 0.28);
  border-radius: 12px;
  color: #dbeafe;
  background: rgba(3, 12, 30, 0.94);
  box-shadow: var(--ts-shadow);
}

.ts-blog-cookie p { margin: 0; font-size: 0.86rem; }
.ts-blog-cookie a { color: #67e8f9; }
.ts-blog-cookie button {
  flex: 0 0 auto;
  min-height: 36px;
  padding: 0 12px;
  color: #042f2e;
  border: 0;
  border-radius: 8px;
  background: #5eead4;
  font-weight: 800;
  cursor: pointer;
}

.ts-blog-cookie[hidden] { display: none; }

@media (max-width: 820px) {
  .ts-blog-shell { width: min(100% - 28px, 680px); }
  .ts-blog-nav { min-height: 68px; gap: 8px; }
  .ts-blog-brand { gap: 8px; }
  .ts-blog-brand img { width: 38px; height: 38px; }
  .ts-blog-header-brand img { width: 132px; height: auto; }
  .ts-blog-brand strong { font-size: 1.1rem; }
  .ts-blog-brand small { font-size: 0.66rem; }
  .ts-blog-actions { gap: 0; }
  .ts-blog-actions > a,
  .ts-blog-actions summary { min-height: 40px; padding: 0 8px; font-size: 0.9rem; }
  .ts-blog-actions .ts-blog-resources-label { display: none; }
  .ts-blog-hero { grid-template-columns: 1fr; gap: 20px; }
  .ts-blog-hero-meta { grid-template-columns: auto 1fr; align-items: center; min-width: 0; }
  .ts-blog-content-grid { grid-template-columns: 1fr; }
  .ts-blog-sidebar { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ts-blog-footer-grid { grid-template-columns: 1fr 1fr; gap: 28px; }
  .ts-blog-footer-grid > :first-child { grid-column: 1 / -1; }
}

@media (max-width: 580px) {
  .ts-blog-shell { width: min(100% - 24px, 520px); }
  .ts-blog-header-brand img { width: 118px; height: auto; }
  .ts-blog-actions > a:first-child { display: none; }
  .ts-blog-actions > a,
  .ts-blog-actions summary { padding: 0 7px; font-size: 0.83rem; }
  .ts-blog-menu { right: -2px; min-width: 172px; }
  .ts-blog-main { padding-top: 24px; }
  .ts-blog-hero { padding: 24px; }
  .ts-blog-hero h1 { font-size: 2.25rem; }
  .ts-blog-list-panel { padding: 6px 16px; }
  .ts-blog-card { grid-template-columns: 1fr; gap: 12px; }
  .ts-blog-card-arrow { width: 42px; }
  .ts-blog-sidebar { grid-template-columns: 1fr; }
  .ts-blog-post { padding: 24px; }
  .ts-blog-post h1 { font-size: 2rem; }
  .ts-blog-footer-grid { grid-template-columns: 1fr; padding-top: 36px; }
  .ts-blog-footer-grid > :first-child { grid-column: auto; }
  .ts-blog-footer-bottom { align-items: flex-start; flex-direction: column; justify-content: center; padding: 16px 0; }
  .ts-blog-cookie { right: 12px; bottom: 12px; left: 12px; max-width: none; align-items: flex-start; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; }
}
