/* ============================================
   SocialEdu - Design System
   Brand: #2563eb (Blue Professional)
   ============================================ */

:root {
  --brand: #2563eb;
  --brand-dark: #1d4ed8;
  --brand-light: #dbeafe;
  --brand-rgb: 37, 99, 235;

  --text: #0f172a;
  --text-muted: #64748b;
  --text-light: #94a3b8;

  --bg: #ffffff;
  --bg-alt: #f8fafc;
  --bg-card: #ffffff;
  --border: #e2e8f0;
  --border-dark: #cbd5e1;

  --shadow-sm: 0 1px 2px rgba(0,0,0,.04);
  --shadow: 0 4px 12px rgba(0,0,0,.06);
  --shadow-lg: 0 12px 32px rgba(0,0,0,.1);

  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 20px;

  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-serif: 'Merriweather', Georgia, serif;

  --container: 1200px;
  --container-narrow: 760px;

  --transition: 0.2s ease;
}

[data-theme="dark"] {
  --text: #f1f5f9;
  --text-muted: #94a3b8;
  --text-light: #64748b;
  --bg: #0f172a;
  --bg-alt: #1e293b;
  --bg-card: #1e293b;
  --border: #334155;
  --border-dark: #475569;
  --brand-light: #1e3a8a;
  --shadow: 0 4px 12px rgba(0,0,0,.3);
  --shadow-lg: 0 12px 32px rgba(0,0,0,.4);
}

/* ============================================
   RESET & BASE
   ============================================ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  scroll-behavior: smooth;
  scroll-padding-top: 90px;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.65;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  transition: background-color var(--transition), color var(--transition);
}

img, svg, video { max-width: 100%; height: auto; display: block; }
a { color: var(--brand); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--brand-dark); }
button { font-family: inherit; cursor: pointer; border: none; background: none; }
input, textarea, select { font-family: inherit; font-size: inherit; }

h1, h2, h3, h4, h5, h6 {
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: -0.02em;
  color: var(--text);
}
h1 { font-size: clamp(1.9rem, 4vw, 2.75rem); }
h2 { font-size: clamp(1.5rem, 3vw, 2rem); }
h3 { font-size: clamp(1.2rem, 2.5vw, 1.5rem); }

p { margin-bottom: 1rem; }

.skip-link {
  position: absolute; left: -9999px; top: 0;
  background: var(--brand); color: #fff;
  padding: 12px 20px; border-radius: 0 0 var(--radius-sm) 0;
  z-index: 9999;
}
.skip-link:focus { left: 0; }

/* ============================================
   LAYOUT
   ============================================ */
.container {
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 20px;
}

.container-narrow {
  max-width: var(--container-narrow);
  margin: 0 auto;
  padding: 0 20px;
}

main { min-height: 60vh; }

.section { padding: 48px 0; }
.section-title {
  font-size: 1.6rem;
  margin-bottom: 24px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.section-title::before {
  content: '';
  width: 4px;
  height: 24px;
  background: var(--brand);
  border-radius: 2px;
}

/* ============================================
   HEADER
   ============================================ */
.reading-progress {
  position: fixed;
  top: 0; left: 0;
  height: 3px;
  background: var(--brand);
  width: 0;
  z-index: 999;
  transition: width 0.1s linear;
}

.site-header {
  position: sticky;
  top: 0;
  background: rgba(255,255,255,0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  z-index: 100;
  transition: background-color var(--transition), border-color var(--transition);
}

[data-theme="dark"] .site-header {
  background: rgba(15,23,42,0.85);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  height: 68px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 1.2rem;
  color: var(--text);
  letter-spacing: -0.02em;
  flex-shrink: 0;
}
.brand-icon { color: var(--brand); }
.brand-text { color: var(--text); }

.main-nav ul {
  display: flex;
  align-items: center;
  gap: 4px;
  list-style: none;
}
.main-nav a {
  display: block;
  padding: 8px 14px;
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--text-muted);
  border-radius: var(--radius-sm);
  transition: all var(--transition);
}
.main-nav a:hover {
  color: var(--brand);
  background: var(--brand-light);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.icon-btn {
  width: 40px; height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  color: var(--text-muted);
  transition: all var(--transition);
}
.icon-btn:hover {
  color: var(--brand);
  background: var(--brand-light);
}
.icon-btn:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}

.theme-toggle .icon-moon { display: none; }
[data-theme="dark"] .theme-toggle .icon-sun { display: none; }
[data-theme="dark"] .theme-toggle .icon-moon { display: block; }

.menu-toggle { display: none; }

.search-bar {
  border-top: 1px solid var(--border);
  padding: 16px 0;
  background: var(--bg);
}
.search-bar form {
  display: flex;
  gap: 10px;
  max-width: 700px;
  margin: 0 auto;
}
.search-bar input {
  flex: 1;
  padding: 12px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-alt);
  color: var(--text);
  font-size: 1rem;
}
.search-bar input:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-light);
}

/* ============================================
   BUTTONS
   ============================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 24px;
  font-size: 0.95rem;
  font-weight: 600;
  border-radius: var(--radius);
  transition: all var(--transition);
  cursor: pointer;
  text-align: center;
}
.btn-primary {
  background: var(--brand);
  color: #fff;
}
.btn-primary:hover {
  background: var(--brand-dark);
  color: #fff;
  transform: translateY(-1px);
  box-shadow: var(--shadow);
}
.btn-outline {
  border: 1.5px solid var(--border-dark);
  color: var(--text);
  background: transparent;
}
.btn-outline:hover {
  border-color: var(--brand);
  color: var(--brand);
}

/* ============================================
   HERO
   ============================================ */
.hero {
  padding: 64px 0 48px;
  text-align: center;
  background: linear-gradient(180deg, var(--bg-alt), var(--bg));
  border-bottom: 1px solid var(--border);
}
.hero h1 {
  max-width: 800px;
  margin: 0 auto 16px;
}
.hero p {
  max-width: 640px;
  margin: 0 auto 28px;
  font-size: 1.1rem;
  color: var(--text-muted);
}
.hero-actions {
  display: flex;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
}

/* ============================================
   GRID & CARD
   ============================================ */
.grid {
  display: grid;
  gap: 24px;
}
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }

.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: all var(--transition);
  height: 100%;
}
.card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
  border-color: var(--brand);
}
.card-link {
  display: flex;
  flex-direction: column;
  height: 100%;
  color: inherit;
}
.card-image {
  position: relative;
  aspect-ratio: 16/9;
  overflow: hidden;
  background: var(--bg-alt);
}
.card-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s ease;
}
.card:hover .card-image img { transform: scale(1.05); }

.card-cat {
  position: absolute;
  top: 12px; left: 12px;
  background: var(--brand);
  color: #fff;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.card-body {
  padding: 20px;
  display: flex;
  flex-direction: column;
  flex: 1;
}
.card-title {
  font-size: 1.1rem;
  margin-bottom: 8px;
  color: var(--text);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.card-excerpt {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-bottom: 16px;
  flex: 1;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.card-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.82rem;
  color: var(--text-light);
  margin-top: auto;
}
.card-meta .dot { opacity: 0.5; }

/* ============================================
   ADSENSE
   ============================================ */
.ad-container {
  margin: 32px 0;
  padding: 12px;
  background: var(--bg-alt);
  border-radius: var(--radius);
  border: 1px dashed var(--border);
  text-align: center;
  min-height: 100px;
}
.ad-label {
  display: block;
  font-size: 0.7rem;
  color: var(--text-light);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 8px;
}
.ad-top { margin-top: 0; }

/* ============================================
   BREADCRUMB
   ============================================ */
.breadcrumb {
  padding: 16px 0;
  font-size: 0.88rem;
}
.breadcrumb ol {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  list-style: none;
  align-items: center;
}
.breadcrumb a { color: var(--text-muted); }
.breadcrumb a:hover { color: var(--brand); }
.breadcrumb .sep { color: var(--text-light); }
.breadcrumb [aria-current="page"] {
  color: var(--text);
  font-weight: 500;
}

/* ============================================
   ARTICLE
   ============================================ */
.article-header {
  padding: 32px 0 24px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 32px;
}
.article-header h1 {
  margin-bottom: 16px;
  font-size: clamp(1.75rem, 3.5vw, 2.5rem);
  line-height: 1.15;
}
.article-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  align-items: center;
  color: var(--text-muted);
  font-size: 0.9rem;
}
.article-meta .author {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 500;
  color: var(--text);
}
.article-meta .avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--brand);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 0.85rem;
}

.article-featured-img {
  width: 100%;
  aspect-ratio: 16/9;
  object-fit: cover;
  border-radius: var(--radius);
  margin-bottom: 32px;
  background: var(--bg-alt);
}

.article-content {
  font-family: var(--font-serif);
  font-size: 1.1rem;
  line-height: 1.85;
  color: var(--text);
}
.article-content h2 {
  font-family: var(--font-sans);
  font-size: 1.6rem;
  margin: 40px 0 16px;
  padding-top: 8px;
}
.article-content h3 {
  font-family: var(--font-sans);
  font-size: 1.3rem;
  margin: 32px 0 12px;
}
.article-content p { margin-bottom: 1.4rem; }
.article-content a {
  color: var(--brand);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}
.article-content a:hover {
  text-decoration-thickness: 2px;
}
.article-content ul, .article-content ol {
  margin: 0 0 1.4rem 1.5rem;
}
.article-content li { margin-bottom: 0.5rem; }
.article-content blockquote {
  margin: 24px 0;
  padding: 16px 24px;
  border-left: 4px solid var(--brand);
  background: var(--bg-alt);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-style: italic;
  color: var(--text-muted);
}
.article-content blockquote p:last-child { margin-bottom: 0; }
.article-content code {
  background: var(--bg-alt);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.9em;
  font-family: 'SF Mono', Consolas, Monaco, monospace;
  color: var(--brand);
}
.article-content pre {
  background: #0f172a;
  color: #e2e8f0;
  padding: 20px;
  border-radius: var(--radius);
  overflow-x: auto;
  margin: 24px 0;
  font-size: 0.9rem;
  line-height: 1.6;
}
.article-content pre code {
  background: transparent;
  color: inherit;
  padding: 0;
}
.article-content img {
  border-radius: var(--radius);
  margin: 24px 0;
}
.article-content hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 40px 0;
}
.article-content .table-wrap {
  overflow-x: auto;
  margin: 24px 0;
}
.article-content table {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--font-sans);
  font-size: 0.95rem;
}
.article-content th, .article-content td {
  padding: 12px 16px;
  border: 1px solid var(--border);
  text-align: left;
}
.article-content th {
  background: var(--bg-alt);
  font-weight: 600;
}

/* TOC */
.toc {
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 24px;
  margin: 0 0 32px;
  font-family: var(--font-sans);
}
.toc-title {
  font-size: 1rem;
  margin-bottom: 12px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}
.toc ul { list-style: none; margin: 0; }
.toc li { margin-bottom: 6px; }
.toc li.toc-sub { padding-left: 20px; font-size: 0.92rem; }
.toc a {
  color: var(--text);
  text-decoration: none;
  border-bottom: 1px solid transparent;
}
.toc a:hover {
  color: var(--brand);
  border-bottom-color: var(--brand);
}

/* Share */
.share-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 32px 0;
  padding: 16px 0;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}
.share-bar span {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-muted);
}
.share-btn {
  width: 40px; height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--bg-alt);
  color: var(--text-muted);
  transition: all var(--transition);
}
.share-btn:hover {
  background: var(--brand);
  color: #fff;
  transform: translateY(-2px);
}

/* Author box */
.author-box {
  display: flex;
  gap: 16px;
  padding: 24px;
  background: var(--bg-alt);
  border-radius: var(--radius);
  margin: 32px 0;
  align-items: flex-start;
}
.author-box .avatar-lg {
  width: 64px; height: 64px;
  border-radius: 50%;
  background: var(--brand);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1.5rem;
  flex-shrink: 0;
}
.author-box h4 { margin-bottom: 6px; font-size: 1rem; }
.author-box p {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-bottom: 0;
  font-family: var(--font-sans);
}

/* ============================================
   PAGINATION
   ============================================ */
.pagination {
  display: flex;
  justify-content: center;
  gap: 6px;
  margin: 48px 0 24px;
  flex-wrap: wrap;
}
.pagination a, .pagination span {
  min-width: 40px;
  height: 40px;
  padding: 0 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  color: var(--text);
  font-weight: 500;
  font-size: 0.95rem;
  transition: all var(--transition);
}
.pagination a:hover {
  border-color: var(--brand);
  color: var(--brand);
  background: var(--brand-light);
}
.pagination .current {
  background: var(--brand);
  color: #fff;
  border-color: var(--brand);
}

/* ============================================
   FOOTER
   ============================================ */
.site-footer {
  background: var(--bg-alt);
  border-top: 1px solid var(--border);
  margin-top: 64px;
  padding: 48px 0 24px;
}
.footer-ads { margin-bottom: 40px; }
.footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: 40px;
  padding-bottom: 40px;
  border-bottom: 1px solid var(--border);
}
.footer-col h3 {
  font-size: 1rem;
  margin-bottom: 16px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text);
}
.footer-col ul { list-style: none; }
.footer-col li { margin-bottom: 10px; }
.footer-col a {
  color: var(--text-muted);
  font-size: 0.92rem;
}
.footer-col a:hover { color: var(--brand); }

.footer-brand p {
  font-size: 0.92rem;
  color: var(--text-muted);
  margin: 16px 0;
  max-width: 320px;
}

.social-links {
  display: flex;
  gap: 10px;
}
.social-links a {
  width: 36px; height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--bg);
  color: var(--text-muted);
  border: 1px solid var(--border);
  transition: all var(--transition);
}
.social-links a:hover {
  background: var(--brand);
  color: #fff;
  border-color: var(--brand);
  transform: translateY(-2px);
}

.footer-bottom {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 24px;
  font-size: 0.85rem;
  color: var(--text-muted);
  flex-wrap: wrap;
  gap: 12px;
}

/* ============================================
   BACK TO TOP
   ============================================ */
.back-to-top {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 48px; height: 48px;
  border-radius: 50%;
  background: var(--brand);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-lg);
  transition: all var(--transition);
  z-index: 50;
}
.back-to-top:hover {
  background: var(--brand-dark);
  transform: translateY(-3px);
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 1024px) {
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .footer-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 768px) {
  .header-inner { height: 60px; }
  .main-nav {
    position: fixed;
    top: 60px; left: 0; right: 0;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    padding: 16px 20px;
    transform: translateY(-100%);
    opacity: 0;
    pointer-events: none;
    transition: all 0.25s ease;
    max-height: calc(100vh - 60px);
    overflow-y: auto;
    box-shadow: var(--shadow);
  }
  .main-nav.open {
    transform: translateY(0);
    opacity: 1;
    pointer-events: auto;
  }
  .main-nav ul {
    flex-direction: column;
    align-items: stretch;
    gap: 4px;
  }
  .main-nav a { padding: 14px 16px; font-size: 1rem; }
  .menu-toggle { display: inline-flex; }
  .search-toggle, .lang-switch { display: none; }

  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .footer-grid { grid-template-columns: 1fr; gap: 32px; }

  .hero { padding: 40px 0 32px; }
  .hero h1 { font-size: 1.7rem; }

  .article-content { font-size: 1.05rem; }

  .back-to-top { bottom: 16px; right: 16px; width: 44px; height: 44px; }

  .footer-bottom {
    flex-direction: column;
    text-align: center;
  }
}

@media (max-width: 480px) {
  .container, .container-narrow { padding: 0 16px; }
  .card-body { padding: 16px; }
  .article-header h1 { font-size: 1.5rem; }
}

/* ============================================
   PRINT
   ============================================ */
@media print {
  .site-header, .site-footer, .back-to-top,
  .ad-container, .share-bar, .toc, .related-section { display: none !important; }
  body { font-size: 12pt; }
  .article-content { font-family: Georgia, serif; }
  a { color: inherit; text-decoration: none; }
}


/* ============================================
   CATEGORY CARD
   ============================================ */
.category-card {
  display: block;
  padding: 24px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  text-align: center;
  transition: all var(--transition);
  color: var(--text);
}
.category-card:hover {
  border-color: var(--brand);
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
  color: var(--brand);
}
.category-card h3 {
  font-size: 1.1rem;
  margin-bottom: 8px;
}
.category-card span {
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* ============================================
   FAQ
   ============================================ */
.faq-section {
  margin: 40px 0;
}
.faq-section h2 {
  margin-bottom: 20px;
}
.faq-item {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 12px;
  padding: 16px 20px;
  background: var(--bg-card);
}
.faq-item summary {
  font-weight: 600;
  cursor: pointer;
  list-style: none;
  position: relative;
  padding-right: 30px;
  font-family: var(--font-sans);
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after {
  content: '+';
  position: absolute;
  right: 0;
  top: 0;
  font-size: 1.5rem;
  color: var(--brand);
  transition: transform var(--transition);
}
.faq-item[open] summary::after {
  transform: rotate(45deg);
}
.faq-item p {
  margin-top: 12px;
  margin-bottom: 0;
  color: var(--text-muted);
  font-family: var(--font-sans);
  font-size: 0.95rem;
}

/* ============================================
   EMPTY STATE
   ============================================ */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}
.empty-state h3 {
  color: var(--text);
  margin-bottom: 8px;
}