/* ============================================
   EdgeFocus Blog — Premium Dark Theme
   ============================================ */

/* --- Reset & Base --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg-primary: #0a0a0f;
  --bg-secondary: #12121a;
  --bg-card: #16161f;
  --bg-card-hover: #1c1c28;
  --bg-code: #1a1a2e;

  --text-primary: #e8e8ed;
  --text-secondary: #9898a6;
  --text-muted: #6b6b7b;

  --accent: #6C5CE7;
  --accent-light: #a29bfe;
  --accent-glow: rgba(108, 92, 231, 0.15);
  --accent-gradient: linear-gradient(135deg, #6C5CE7 0%, #a29bfe 100%);

  --border: #2a2a3a;
  --border-light: #1e1e2e;

  --radius-sm: 6px;
  --radius-md: 12px;
  --radius-lg: 20px;

  --shadow-card: 0 2px 20px rgba(0, 0, 0, 0.3);
  --shadow-card-hover: 0 8px 40px rgba(108, 92, 231, 0.12);

  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;

  --container: 1200px;
  --container-narrow: 760px;

  --header-height: 72px;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-body);
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.7;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

main { flex: 1; }

a {
  color: var(--accent-light);
  text-decoration: none;
  transition: color 0.2s;
}
a:hover { color: #fff; }

img { max-width: 100%; height: auto; display: block; border-radius: var(--radius-md); }

::selection {
  background: var(--accent);
  color: #fff;
}

/* --- Container --- */
.container {
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 24px;
}
.container--narrow {
  max-width: var(--container-narrow);
  margin: 0 auto;
  padding: 0 24px;
}

/* --- Header --- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(10, 10, 15, 0.85);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border-bottom: 1px solid var(--border-light);
  height: var(--header-height);
}

.site-header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: var(--header-height);
}

.site-header__logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--text-primary);
  letter-spacing: -0.02em;
}
.site-header__logo:hover { color: #fff; }
.site-header__logo svg { flex-shrink: 0; }

.site-header__nav {
  display: flex;
  align-items: center;
  gap: 24px;
}
.site-header__nav a {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-secondary);
  transition: color 0.2s;
}
.site-header__nav a:hover { color: #fff; }

.lang-switch {
  padding: 4px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.lang-switch:hover {
  border-color: var(--accent);
  color: var(--accent-light) !important;
}

/* --- Hero --- */
.hero {
  padding: 80px 0 60px;
  text-align: center;
  position: relative;
}
.hero::before {
  content: '';
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 600px;
  height: 400px;
  background: radial-gradient(ellipse, var(--accent-glow) 0%, transparent 70%);
  pointer-events: none;
}

.hero-title {
  font-size: clamp(2rem, 5vw, 3.5rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.1;
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 16px;
  position: relative;
}

.hero-subtitle {
  font-size: 1.15rem;
  color: var(--text-secondary);
  font-weight: 400;
  position: relative;
}

/* --- Post Cards --- */
.posts-section { padding: 0 0 80px; }

.post-card {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: transform 0.3s, box-shadow 0.3s, border-color 0.3s;
}
.post-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-card-hover);
  border-color: var(--border);
}

.post-card--featured {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
  margin-bottom: 48px;
}

.post-card__image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 0;
}

.post-card__body { padding: 32px; }
.post-card--featured .post-card__body {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 48px;
}

.post-card__categories { margin-bottom: 12px; }

.tag {
  display: inline-block;
  padding: 4px 12px;
  background: var(--accent-glow);
  color: var(--accent-light);
  font-size: 0.75rem;
  font-weight: 600;
  border-radius: 100px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-right: 6px;
}

.post-card__title {
  font-size: 1.4rem;
  font-weight: 700;
  line-height: 1.3;
  letter-spacing: -0.02em;
  margin-bottom: 12px;
}
.post-card--featured .post-card__title { font-size: 1.8rem; }
.post-card__title a { color: var(--text-primary); }
.post-card__title a:hover { color: var(--accent-light); }

.post-card__excerpt {
  color: var(--text-secondary);
  font-size: 0.95rem;
  line-height: 1.6;
  margin-bottom: 16px;
}

.post-card__meta {
  display: flex;
  align-items: center;
  gap: 16px;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.posts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 24px;
}
.posts-grid--compact {
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
}
.post-card--compact .post-card__body { padding: 20px; }
.post-card--compact .post-card__title { font-size: 1rem; }

/* --- Article --- */
.article__header {
  padding: 60px 0 32px;
  text-align: center;
}

.article__categories { margin-bottom: 16px; }

.article__title {
  font-size: clamp(1.8rem, 4vw, 2.8rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.15;
  margin-bottom: 16px;
}

.article__subtitle {
  font-size: 1.2rem;
  color: var(--text-secondary);
  margin-bottom: 24px;
}

.article__meta {
  display: flex;
  justify-content: center;
}

.article__author {
  display: flex;
  align-items: center;
  gap: 12px;
}
.article__author-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 2px solid var(--border);
}
.article__author-name {
  font-weight: 600;
  font-size: 0.9rem;
}
.article__date-line {
  font-size: 0.8rem;
  color: var(--text-muted);
  display: flex;
  gap: 12px;
}

.article__cover {
  margin: 32px 0 48px;
}
.article__cover img {
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
}

/* --- Table of Contents --- */
.article__toc {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 24px;
  margin-bottom: 40px;
}
.article__toc summary {
  font-weight: 700;
  font-size: 0.9rem;
  cursor: pointer;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.article__toc nav { margin-top: 16px; }
.article__toc ul {
  list-style: none;
  padding-left: 0;
}
.article__toc li { padding: 4px 0; }
.article__toc li li { padding-left: 20px; }
.article__toc a {
  color: var(--text-secondary);
  font-size: 0.9rem;
  border-bottom: 1px solid transparent;
  transition: color 0.2s, border-color 0.2s;
}
.article__toc a:hover {
  color: var(--accent-light);
  border-bottom-color: var(--accent-light);
}

/* --- Article Content --- */
.article__content {
  font-size: 1.05rem;
  line-height: 1.8;
}
.article__content h2 {
  font-size: 1.6rem;
  font-weight: 700;
  margin: 56px 0 20px;
  letter-spacing: -0.02em;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border-light);
}
.article__content h3 {
  font-size: 1.25rem;
  font-weight: 700;
  margin: 40px 0 16px;
  letter-spacing: -0.01em;
}
.article__content h4 {
  font-size: 1.05rem;
  font-weight: 600;
  margin: 32px 0 12px;
  color: var(--accent-light);
}
.article__content p { margin-bottom: 20px; }
.article__content ul, .article__content ol {
  margin-bottom: 20px;
  padding-left: 24px;
}
.article__content li { margin-bottom: 8px; }
.article__content strong { color: #fff; font-weight: 600; }
.article__content em { color: var(--text-secondary); }

.article__content blockquote {
  border-left: 3px solid var(--accent);
  background: var(--accent-glow);
  padding: 20px 24px;
  margin: 24px 0;
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  font-style: italic;
  color: var(--text-secondary);
}
.article__content blockquote strong { color: var(--accent-light); }

.article__content code {
  font-family: var(--font-mono);
  background: var(--bg-code);
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 0.88em;
  color: var(--accent-light);
}
.article__content pre {
  background: var(--bg-code);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 24px;
  margin: 24px 0;
  overflow-x: auto;
}
.article__content pre code {
  background: none;
  padding: 0;
  font-size: 0.85rem;
  line-height: 1.6;
  color: var(--text-primary);
}

.article__content table {
  width: 100%;
  border-collapse: collapse;
  margin: 24px 0;
  font-size: 0.9rem;
}
.article__content th, .article__content td {
  padding: 12px 16px;
  text-align: left;
  border-bottom: 1px solid var(--border-light);
}
.article__content th {
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  font-size: 0.8rem;
  letter-spacing: 0.05em;
}
.article__content tr:hover td { background: var(--bg-card); }

.article__content hr {
  border: none;
  border-top: 1px solid var(--border-light);
  margin: 48px 0;
}

.article__content a {
  color: var(--accent-light);
  border-bottom: 1px solid rgba(162, 155, 254, 0.3);
  transition: border-color 0.2s;
}
.article__content a:hover { border-bottom-color: var(--accent-light); }

/* --- FAQ --- */
.article__faq {
  margin: 56px 0 40px;
  padding: 32px;
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
}
.article__faq h2 {
  font-size: 1.4rem;
  margin-bottom: 24px;
  border-bottom: none;
  padding-bottom: 0;
}

.faq-item {
  border-bottom: 1px solid var(--border-light);
  padding: 16px 0;
}
.faq-item:last-child { border-bottom: none; }
.faq-item summary {
  font-weight: 600;
  font-size: 1rem;
  cursor: pointer;
  color: var(--text-primary);
  padding: 4px 0;
  transition: color 0.2s;
}
.faq-item summary:hover { color: var(--accent-light); }
.faq-item summary::marker { color: var(--accent); }
.faq-answer {
  padding: 12px 0 4px;
  color: var(--text-secondary);
  line-height: 1.7;
}
.faq-answer p { margin-bottom: 8px; }

/* --- Tags --- */
.article__tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 40px 0;
  padding-top: 24px;
  border-top: 1px solid var(--border-light);
}

/* --- Author Bio --- */
.article__author-bio {
  display: flex;
  gap: 20px;
  align-items: flex-start;
  padding: 32px;
  margin: 40px 0;
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
}
.article__author-bio-avatar {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  border: 2px solid var(--accent);
  flex-shrink: 0;
}
.article__author-bio strong {
  font-size: 1.05rem;
  display: block;
  margin-bottom: 8px;
}
.article__author-bio p {
  color: var(--text-secondary);
  font-size: 0.9rem;
  line-height: 1.6;
  margin-bottom: 12px;
}
.article__author-links {
  display: flex;
  gap: 16px;
}
.article__author-links a {
  font-size: 0.85rem;
  font-weight: 500;
}

/* --- Related Posts --- */
.article__related { margin: 48px 0; }
.article__related h2 {
  font-size: 1.3rem;
  margin-bottom: 20px;
  border-bottom: none;
  padding-bottom: 0;
}

/* --- CTA Block --- */
.cta-block {
  text-align: center;
  margin: 40px 0;
}
.cta-button {
  display: inline-block;
  padding: 14px 36px;
  background: var(--accent-gradient);
  color: #fff !important;
  font-weight: 700;
  font-size: 1rem;
  border-radius: 100px;
  transition: transform 0.2s, box-shadow 0.2s;
  box-shadow: 0 4px 20px rgba(108, 92, 231, 0.3);
  border: none;
}
.cta-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 30px rgba(108, 92, 231, 0.4);
}

/* --- Footer --- */
.site-footer {
  border-top: 1px solid var(--border-light);
  padding: 48px 0;
  margin-top: 80px;
}
.site-footer__inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
}
.site-footer__brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  color: var(--text-secondary);
}
.site-footer__links {
  display: flex;
  gap: 24px;
  flex-wrap: wrap;
  justify-content: center;
}
.site-footer__links a {
  font-size: 0.85rem;
  color: var(--text-muted);
}
.site-footer__links a:hover { color: var(--text-primary); }
.site-footer__copy {
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* --- Pagination --- */
.pagination {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-top: 48px;
  list-style: none;
  padding: 0;
}
.pagination li { list-style: none; }
.page-item a, .page-item span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  font-size: 0.9rem;
  color: var(--text-secondary);
  transition: all 0.2s;
}
.page-item.active span {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.page-item a:hover {
  border-color: var(--accent);
  color: var(--accent-light);
}

/* --- Responsive --- */
@media (max-width: 768px) {
  .post-card--featured { grid-template-columns: 1fr; }
  .post-card--featured .post-card__body { padding: 24px; }
  .posts-grid { grid-template-columns: 1fr; }
  .site-header__nav { gap: 16px; }
  .hero { padding: 48px 0 32px; }
  .article__header { padding: 32px 0 20px; }
  .article__author-bio { flex-direction: column; align-items: center; text-align: center; }
  .article__author-links { justify-content: center; }
}

@media (max-width: 480px) {
  :root { --header-height: 60px; }
  .site-header__nav { gap: 10px; }
  .site-header__nav a { font-size: 0.8rem; }
  .post-card__body { padding: 20px; }
  .article__faq { padding: 20px; }
}

/* --- Print --- */
@media print {
  .site-header, .site-footer, .article__toc, .cta-block, .lang-switch { display: none; }
  body { background: #fff; color: #000; }
  .article__content a { color: #000; border-bottom: 1px solid #000; }
  .article__content a::after { content: " (" attr(href) ")"; font-size: 0.8em; }
}
