/* ============================================
   Integrated Hybrid Assembly — Design System
   ============================================ */

/* ---------- Google Font ---------- */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

/* ---------- CSS Custom Properties ---------- */
:root {
  /* Navy palette */
  --navy-900: #0a1628;
  --navy-800: #0f2040;
  --navy-700: #1e3a5f;
  --navy-600: #234b78;
  --navy-500: #2a5791;

  /* Blue accent */
  --blue-600: #3b82f6;
  --blue-500: #60a5fa;
  --blue-400: #93c5fd;
  --blue-100: #dbeafe;

  /* Light background */
  --bg-light: #f8f9fc;
  --bg-white: #ffffff;

  /* Text */
  --text-primary: #334155;
  --text-secondary: #64748b;
  --text-muted: #94a3b8;

  /* Borders */
  --border-light: #e2e8f0;
  --border-medium: #cbd5e1;

  /* Status */
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;

  /* Shadows */
  --shadow-sm: 0 1px 3px rgba(10,22,40,0.08), 0 1px 2px rgba(10,22,40,0.06);
  --shadow-md: 0 4px 12px rgba(10,22,40,0.10), 0 2px 6px rgba(10,22,40,0.06);
  --shadow-lg: 0 10px 30px rgba(10,22,40,0.12), 0 4px 12px rgba(10,22,40,0.08);

  /* Spacing */
  --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;
  --space-10: 2.5rem;
  --space-12: 3rem;
  --space-16: 4rem;
  --space-20: 5rem;

  /* Border radius */
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --radius-full: 9999px;

  /* Typography */
  --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-size-xs: 0.75rem;
  --font-size-sm: 0.875rem;
  --font-size-base: 1rem;
  --font-size-lg: 1.125rem;
  --font-size-xl: 1.25rem;
  --font-size-2xl: 1.5rem;
  --font-size-3xl: 1.875rem;
  --font-size-4xl: 2.25rem;
  --font-size-5xl: 3rem;

  /* Layout */
  --container-max: 1280px;
  --container-article: 1200px;
  --sidebar-width: 300px;
  --hero-height: 480px;
}

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

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-family);
  font-size: var(--font-size-base);
  line-height: 1.7;
  color: var(--text-primary);
  background-color: var(--bg-light);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

a {
  color: var(--blue-600);
  text-decoration: none;
  transition: color 0.2s ease;
}

a:hover {
  color: var(--blue-500);
  text-decoration: underline;
}

ul, ol {
  list-style: none;
}

/* ---------- Layout ---------- */
.container {
  max-width: var(--container-article);
  margin: 0 auto;
  padding: 0 var(--space-6);
}

/* ---------- Hero Section ---------- */
.hero-header {
  background: linear-gradient(135deg, var(--navy-900) 0%, var(--navy-700) 60%, var(--navy-600) 100%);
  color: white;
  position: relative;
  overflow: hidden;
  min-height: var(--hero-height);
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
}

.hero-header::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse at 20% 50%, rgba(59,130,246,0.15) 0%, transparent 60%),
    radial-gradient(ellipse at 80% 20%, rgba(96,165,250,0.10) 0%, transparent 50%);
  pointer-events: none;
}

.hero-header::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 80px;
  background: linear-gradient(to top, var(--bg-light), transparent);
}

.hero-header .container {
  position: relative;
  z-index: 1;
  padding-bottom: var(--space-12);
}

.hero-content {
  max-width: 800px;
}

/* ---------- Breadcrumb ---------- */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-4) 0;
  font-size: var(--font-size-sm);
  color: var(--blue-400);
}

.breadcrumb a {
  color: var(--blue-400);
  transition: color 0.2s;
}

.breadcrumb a:hover {
  color: white;
  text-decoration: none;
}

.breadcrumb-sep {
  opacity: 0.5;
}

.breadcrumb-current {
  color: rgba(255,255,255,0.7);
}

/* ---------- Category Badge ---------- */
.badge {
  display: inline-block;
  padding: var(--space-1) var(--space-3);
  border-radius: var(--radius-full);
  font-size: var(--font-size-xs);
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.badge-blog {
  background: rgba(59,130,246,0.2);
  color: var(--blue-400);
  border: 1px solid rgba(59,130,246,0.3);
}

.badge-guide {
  background: rgba(16,185,129,0.2);
  color: var(--success);
  border: 1px solid rgba(16,185,129,0.3);
}

.badge-tutorial {
  background: rgba(245,158,11,0.2);
  color: var(--warning);
  border: 1px solid rgba(10,165,11,0.3);
}

/* ---------- Article Hero Meta ---------- */
.article-hero-meta {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  margin-top: var(--space-4);
  flex-wrap: wrap;
}

.article-hero-meta .reading-time {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--font-size-sm);
  color: rgba(255,255,255,0.7);
}

.article-hero-meta .reading-time svg {
  flex-shrink: 0;
}

/* ---------- Article Title ---------- */
.article-title {
  font-size: clamp(1.875rem, 4vw, var(--font-size-4xl));
  font-weight: 800;
  line-height: 1.2;
  color: white;
  margin-top: var(--space-4);
  letter-spacing: -0.02em;
}

.article-lead {
  font-size: var(--font-size-lg);
  color: rgba(255,255,255,0.8);
  margin-top: var(--space-4);
  max-width: 720px;
  line-height: 1.6;
}

/* ---------- Article Layout ---------- */
.article-layout {
  max-width: var(--container-article);
  margin: 0 auto;
  padding: var(--space-10) var(--space-6);
  display: grid;
  grid-template-columns: 1fr var(--sidebar-width);
  gap: var(--space-10);
  align-items: start;
}

/* ---------- Article Body ---------- */
.article-body {
  min-width: 0;
}

.article-body h2 {
  font-size: var(--font-size-2xl);
  font-weight: 700;
  color: var(--navy-900);
  margin-top: var(--space-12);
  margin-bottom: var(--space-4);
  letter-spacing: -0.01em;
  padding-bottom: var(--space-3);
  border-bottom: 2px solid var(--border-light);
}

.article-body h3 {
  font-size: var(--font-size-xl);
  font-weight: 600;
  color: var(--navy-800);
  margin-top: var(--space-8);
  margin-bottom: var(--space-3);
}

.article-body h4 {
  font-size: var(--font-size-lg);
  font-weight: 600;
  color: var(--text-primary);
  margin-top: var(--space-6);
  margin-bottom: var(--space-2);
}

.article-body p {
  margin-bottom: var(--space-5);
  color: var(--text-primary);
  line-height: 1.8;
}

.article-body ul,
.article-body ol {
  margin-bottom: var(--space-5);
  padding-left: var(--space-6);
}

.article-body ul { list-style: disc; }
.article-body ol { list-style: decimal; }

.article-body li {
  margin-bottom: var(--space-2);
  color: var(--text-primary);
  line-height: 1.7;
}

.article-body strong {
  font-weight: 600;
  color: var(--text-primary);
}

.article-body code {
  background: var(--bg-light);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  padding: 0.1em 0.4em;
  font-size: 0.875em;
  font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
  color: var(--navy-700);
}

.article-body pre {
  background: var(--navy-900);
  border-radius: var(--radius-md);
  padding: var(--space-5);
  overflow-x: auto;
  margin-bottom: var(--space-5);
}

.article-body pre code {
  background: none;
  border: none;
  padding: 0;
  color: #e2e8f0;
  font-size: var(--font-size-sm);
}

.article-body blockquote {
  border-left: 4px solid var(--blue-600);
  background: var(--blue-100);
  padding: var(--space-4) var(--space-5);
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  margin-bottom: var(--space-5);
  font-style: italic;
  color: var(--text-secondary);
}

.article-body table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: var(--space-6);
  font-size: var(--font-size-sm);
  box-shadow: var(--shadow-sm);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.article-body th {
  background: var(--navy-900);
  color: white;
  padding: var(--space-3) var(--space-4);
  text-align: left;
  font-weight: 600;
  font-size: var(--font-size-xs);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.article-body td {
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--border-light);
  color: var(--text-primary);
  vertical-align: top;
}

.article-body tr:last-child td {
  border-bottom: none;
}

.article-body tr:nth-child(even) td {
  background: var(--bg-light);
}

/* ---------- Question Card (Listicles) ---------- */
.question-card {
  background: var(--bg-white);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: var(--space-6) var(--space-8);
  margin-bottom: var(--space-6);
  box-shadow: var(--shadow-sm);
  position: relative;
  transition: box-shadow 0.2s;
}

.question-card:hover {
  box-shadow: var(--shadow-md);
}

.question-card .question-number {
  position: absolute;
  top: -1px;
  left: var(--space-6);
  background: var(--blue-600);
  color: white;
  font-size: var(--font-size-xs);
  font-weight: 700;
  padding: var(--space-1) var(--space-3);
  border-radius: 0 0 var(--radius-sm) var(--radius-sm);
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.question-card h2 {
  font-size: var(--font-size-xl);
  font-weight: 700;
  color: var(--navy-900);
  margin-top: var(--space-3);
  margin-bottom: var(--space-3);
  border-bottom: none;
  padding-bottom: 0;
}

.question-card h3 {
  font-size: var(--font-size-lg);
  font-weight: 600;
  color: var(--navy-700);
  margin-top: var(--space-4);
  margin-bottom: var(--space-2);
}

.question-card p {
  margin-bottom: var(--space-3);
  color: var(--text-secondary);
  line-height: 1.7;
}

.question-card ul {
  list-style: disc;
  padding-left: var(--space-6);
  margin-bottom: var(--space-4);
}

.question-card li {
  margin-bottom: var(--space-2);
  color: var(--text-secondary);
}

/* ---------- Action Box ---------- */
.action-box {
  background: linear-gradient(135deg, var(--navy-900), var(--navy-700));
  border-radius: var(--radius-md);
  padding: var(--space-5) var(--space-6);
  margin-top: var(--space-4);
  border-left: 4px solid var(--blue-600);
}

.action-box h4 {
  font-size: var(--font-size-sm);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--blue-400);
  margin-top: 0;
  margin-bottom: var(--space-2);
}

.action-box p {
  color: rgba(255,255,255,0.85);
  margin-bottom: 0;
  font-size: var(--font-size-sm);
}

/* ---------- Sidebar ---------- */
.article-sidebar {
  position: sticky;
  top: var(--space-6);
  max-height: calc(100vh - var(--space-12));
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--border-medium) transparent;
}

.article-sidebar::-webkit-scrollbar {
  width: 4px;
}

.article-sidebar::-webkit-scrollbar-track {
  background: transparent;
}

.article-sidebar::-webkit-scrollbar-thumb {
  background: var(--border-medium);
  border-radius: var(--radius-full);
}

/* ---------- Sidebar Widget ---------- */
.sidebar-widget {
  background: var(--bg-white);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  margin-bottom: var(--space-5);
  box-shadow: var(--shadow-sm);
}

.sidebar-widget h3 {
  font-size: var(--font-size-sm);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--navy-700);
  margin-bottom: var(--space-4);
  padding-bottom: var(--space-3);
  border-bottom: 2px solid var(--blue-600);
}

/* ---------- TOC ---------- */
.toc-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.toc-list li {
  margin-bottom: 0;
}

.toc-list a {
  display: block;
  padding: var(--space-2) var(--space-3);
  font-size: var(--font-size-sm);
  color: var(--text-secondary);
  border-radius: var(--radius-sm);
  transition: all 0.2s;
  border-left: 2px solid transparent;
}

.toc-list a:hover,
.toc-list a.active {
  color: var(--blue-600);
  background: var(--blue-100);
  border-left-color: var(--blue-600);
  text-decoration: none;
  font-weight: 500;
}

.toc-list .toc-h3 {
  padding-left: var(--space-6);
  font-size: var(--font-size-xs);
}

/* ---------- Related Articles ---------- */
.related-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.related-list li {
  margin-bottom: var(--space-3);
  padding-bottom: var(--space-3);
  border-bottom: 1px solid var(--border-light);
}

.related-list li:last-child {
  margin-bottom: 0;
  padding-bottom: 0;
  border-bottom: none;
}

.related-list a {
  font-size: var(--font-size-sm);
  font-weight: 500;
  color: var(--text-primary);
  line-height: 1.4;
  display: block;
  transition: color 0.2s;
}

.related-list a:hover {
  color: var(--blue-600);
  text-decoration: none;
}

.related-list .related-category {
  display: block;
  font-size: var(--font-size-xs);
  color: var(--text-muted);
  margin-top: var(--space-1);
}

/* ---------- CTA Banner ---------- */
.cta-banner {
  background: linear-gradient(135deg, var(--navy-900) 0%, var(--navy-700) 100%);
  border-radius: var(--radius-xl);
  padding: var(--space-10) var(--space-8);
  text-align: center;
  margin-top: var(--space-12);
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-lg);
}

.cta-banner::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at 50% 0%, rgba(59,130,246,0.2) 0%, transparent 70%);
  pointer-events: none;
}

.cta-banner h2 {
  font-size: var(--font-size-2xl);
  font-weight: 800;
  color: white;
  margin-bottom: var(--space-3);
  position: relative;
}

.cta-banner p {
  font-size: var(--font-size-lg);
  color: rgba(255,255,255,0.8);
  max-width: 560px;
  margin: 0 auto var(--space-6);
  position: relative;
}

.cta-banner .btn {
  position: relative;
  display: inline-block;
  padding: var(--space-3) var(--space-8);
  background: var(--blue-600);
  color: white;
  border-radius: var(--radius-full);
  font-weight: 600;
  font-size: var(--font-size-base);
  transition: all 0.2s;
  box-shadow: 0 4px 15px rgba(59,130,246,0.4);
}

.cta-banner .btn:hover {
  background: var(--blue-500);
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(59,130,246,0.5);
  text-decoration: none;
  color: white;
}

/* ---------- Footer ---------- */
.site-footer {
  background: var(--navy-900);
  color: rgba(255,255,255,0.6);
  padding: var(--space-10) 0 var(--space-6);
  margin-top: var(--space-16);
}

.footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: var(--space-10);
  margin-bottom: var(--space-8);
}

.footer-brand p {
  font-size: var(--font-size-sm);
  line-height: 1.6;
  max-width: 320px;
  margin-top: var(--space-3);
}

.footer-col h4 {
  font-size: var(--font-size-sm);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: rgba(255,255,255,0.9);
  margin-bottom: var(--space-4);
}

.footer-col ul {
  list-style: none;
  padding: 0;
}

.footer-col li {
  margin-bottom: var(--space-2);
}

.footer-col a {
  font-size: var(--font-size-sm);
  color: rgba(255,255,255,0.5);
  transition: color 0.2s;
}

.footer-col a:hover {
  color: white;
  text-decoration: none;
}

.footer-bottom {
  border-top: 1px solid rgba(255,255,255,0.1);
  padding-top: var(--space-5);
  font-size: var(--font-size-sm);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* ---------- Responsive ---------- */
@media (max-width: 1024px) {
  .article-layout {
    grid-template-columns: 1fr;
  }

  .article-sidebar {
    position: static;
    max-height: none;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-5);
  }

  .article-sidebar .sidebar-widget {
    margin-bottom: 0;
  }

  .footer-grid {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 768px) {
  :root {
    --hero-height: 380px;
  }

  .article-title {
    font-size: var(--font-size-2xl);
  }

  .article-sidebar {
    grid-template-columns: 1fr;
  }

  .footer-grid {
    grid-template-columns: 1fr;
  }

  .footer-bottom {
    flex-direction: column;
    gap: var(--space-3);
    text-align: center;
  }

  .cta-banner {
    padding: var(--space-8) var(--space-5);
  }

  .question-card {
    padding: var(--space-5) var(--space-5);
  }
}

@media (max-width: 480px) {
  .container {
    padding: 0 var(--space-4);
  }

  .article-hero-meta {
    gap: var(--space-3);
  }
}
