/* ═══════════════════════════════════════════════════════════════
   TechCoreX — Practical Engineering Skills
   Dark theme · Teal accent · Tutorial-first layout
   ═══════════════════════════════════════════════════════════════ */

/* ── Design Tokens ── */
:root {
  --bg: #0f172a;
  --bg-card: #1e293b;
  --bg-card-hover: #273449;
  --bg-input: #0f172a;
  --border: #334155;
  --border-light: #475569;
  --text: #e2e8f0;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --accent: #14b8a6;
  --accent-hover: #0d9488;
  --accent-glow: rgba(20, 184, 166, 0.15);
  --blue: #60a5fa;
  --blue-glow: rgba(96, 165, 250, 0.15);
  --amber: #f59e0b;
  --red: #ef4444;
  --green: #22c55e;
  --radius: 8px;
  --radius-lg: 12px;
  --shadow: 0 1px 3px rgba(0,0,0,0.3), 0 1px 2px rgba(0,0,0,0.4);
  --shadow-lg: 0 4px 14px rgba(0,0,0,0.4), 0 0 0 1px rgba(255,255,255,0.03);
  --font: 'Segoe UI', system-ui, -apple-system, sans-serif;
  --font-mono: 'Cascadia Code', 'Fira Code', 'JetBrains Mono', 'Consolas', monospace;
  --max-width: 1024px;
}

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); }
img { max-width: 100%; display: block; }
table { border-collapse: collapse; width: 100%; }
th, td { padding: 10px 14px; text-align: left; border-bottom: 1px solid var(--border); }
th { font-weight: 600; color: var(--text-secondary); font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.05em; }
code { font-family: var(--font-mono); background: rgba(255,255,255,0.06); padding: 2px 6px; border-radius: 4px; font-size: 0.9em; }
pre { background: #0c1222; border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; overflow-x: auto; font-family: var(--font-mono); font-size: 0.88rem; line-height: 1.6; }
pre code { background: none; padding: 0; }

/* ── Skip Link ── */
.skip-link { position: absolute; top: -100px; left: 12px; background: var(--accent); color: #000; padding: 8px 16px; border-radius: 0 0 var(--radius) var(--radius); z-index: 1000; font-weight: 600; }
.skip-link:focus { top: 0; }

/* ── Site Header ── */
.site-header {
  position: sticky; top: 0; z-index: 100;
  background: rgba(15, 23, 42, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}
.header-inner {
  max-width: var(--max-width); margin: 0 auto;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 20px; height: 56px;
}
.header-brand {
  display: flex; align-items: center; gap: 8px;
  font-weight: 700; font-size: 1.15rem; color: var(--text);
}
.header-brand .brand-icon {
  width: 28px; height: 28px; background: linear-gradient(135deg, var(--accent), #0d9488);
  border-radius: 6px; display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 0.85rem; font-weight: 800;
}
.header-brand span { color: var(--accent); }
.header-nav { display: flex; align-items: center; gap: 4px; }
.header-nav a {
  padding: 6px 14px; border-radius: var(--radius); font-size: 0.9rem;
  color: var(--text-secondary); transition: all 0.15s;
}
.header-nav a:hover, .header-nav a.active { color: var(--accent); background: var(--accent-glow); }
.header-actions { display: flex; align-items: center; gap: 8px; }
.header-search {
  background: var(--bg-input); border: 1px solid var(--border); border-radius: 20px;
  padding: 6px 14px; color: var(--text); font-size: 0.85rem; outline: none;
  width: 160px; transition: border-color 0.2s;
}
.header-search:focus { border-color: var(--accent); width: 200px; }
.btn-theme {
  background: none; border: 1px solid var(--border); border-radius: 50%;
  width: 34px; height: 34px; font-size: 1rem; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-secondary); transition: all 0.15s;
}
.btn-theme:hover { border-color: var(--accent); color: var(--accent); }
.btn-hamburger {
  display: none; background: none; border: none; color: var(--text);
  font-size: 1.4rem; cursor: pointer; padding: 4px;
}

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

/* ── Hero ── */
.hero { padding: 48px 0 32px; text-align: center; }
.hero h1 { font-size: 2.2rem; font-weight: 800; letter-spacing: -0.02em; }
.hero h1 span { color: var(--accent); }
.hero p { color: var(--text-secondary); font-size: 1.1rem; max-width: 640px; margin: 12px auto 0; }

/* ── Category Grid ── */
.category-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px; padding: 0 0 48px;
}
.category-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 24px;
  transition: all 0.2s;
}
.category-card:hover { background: var(--bg-card-hover); border-color: var(--accent); box-shadow: var(--shadow-lg); }
.category-card h3 { font-size: 1.15rem; margin-bottom: 6px; display: flex; align-items: center; gap: 8px; }
.category-card p { color: var(--text-secondary); font-size: 0.9rem; margin-bottom: 12px; line-height: 1.5; }
.category-card .card-count { font-size: 0.8rem; color: var(--text-muted); }
.category-card .card-arrow { color: var(--accent); font-weight: 600; font-size: 0.9rem; margin-top: 8px; display: inline-block; }

/* ── Tutorial Card ── */
.tutorial-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px; padding: 0 0 48px;
}
.tutorial-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 20px;
  transition: all 0.2s; display: flex; flex-direction: column;
}
.tutorial-card:hover { background: var(--bg-card-hover); border-color: var(--accent); box-shadow: var(--shadow-lg); }
.tutorial-card .tutorial-tag {
  display: inline-block; padding: 2px 10px; border-radius: 12px;
  font-size: 0.75rem; font-weight: 600; margin-bottom: 10px;
  background: var(--accent-glow); color: var(--accent);
}
.tutorial-card h3 { font-size: 1.05rem; margin-bottom: 6px; line-height: 1.4; }
.tutorial-card p { color: var(--text-secondary); font-size: 0.88rem; line-height: 1.5; flex: 1; }
.tutorial-card .tutorial-meta { font-size: 0.78rem; color: var(--text-muted); margin-top: 10px; }

/* ── Section heading ── */
.section-heading {
  font-size: 1.4rem; font-weight: 700; margin: 40px 0 16px;
  padding-bottom: 8px; border-bottom: 2px solid var(--border);
}

/* ── Breadcrumb ── */
.breadcrumb { padding: 16px 0; font-size: 0.85rem; color: var(--text-muted); }
.breadcrumb a { color: var(--text-secondary); }
.breadcrumb a:hover { color: var(--accent); }
.breadcrumb .sep { margin: 0 8px; color: var(--border-light); }

/* ── Tutorial Page Layout ── */
.page-container { max-width: var(--max-width); margin: 0 auto; padding: 0 20px; }
.page-header { padding: 16px 0 20px; }
.page-header h1 { font-size: 1.8rem; font-weight: 800; letter-spacing: -0.01em; }
.page-header .page-subtitle { color: var(--text-secondary); font-size: 1.05rem; margin-top: 6px; }
.page-header .page-meta { display: flex; gap: 16px; margin-top: 10px; font-size: 0.82rem; color: var(--text-muted); }

/* ── Step Cards ── */
.step-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 24px; margin-bottom: 16px;
}
.step-card .step-number {
  display: inline-flex; align-items: center; justify-content: center;
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--accent); color: #000; font-weight: 700; font-size: 0.9rem;
  margin-bottom: 10px;
}
.step-card h3 { font-size: 1.1rem; margin-bottom: 8px; }
.step-card p, .step-card li { color: var(--text-secondary); font-size: 0.95rem; line-height: 1.65; }
.step-card ul, .step-card ol { padding-left: 20px; margin: 8px 0; }
.step-card li { margin-bottom: 4px; }

/* ── Tips / Warning Boxes ── */
.tip-box, .warn-box, .info-box {
  border-radius: var(--radius); padding: 14px 18px; margin: 16px 0;
  font-size: 0.92rem; line-height: 1.6;
}
.tip-box { background: rgba(34, 197, 94, 0.08); border: 1px solid rgba(34, 197, 94, 0.2); }
.tip-box::before { content: '💡 Tip: '; font-weight: 700; color: var(--green); }
.warn-box { background: rgba(239, 68, 68, 0.08); border: 1px solid rgba(239, 68, 68, 0.2); }
.warn-box::before { content: '⚠️  Warning: '; font-weight: 700; color: var(--red); }
.info-box { background: rgba(96, 165, 250, 0.08); border: 1px solid rgba(96, 165, 250, 0.2); }
.info-box::before { content: '📘 Note: '; font-weight: 700; color: var(--blue); }

/* ── Key Takeaways ── */
.key-takeaways {
  background: var(--accent-glow); border: 1px solid rgba(20, 184, 166, 0.25);
  border-radius: var(--radius-lg); padding: 20px 24px; margin: 20px 0;
}
.key-takeaways h4 { color: var(--accent); margin-bottom: 8px; }
.key-takeaways ul { padding-left: 18px; }
.key-takeaways li { color: var(--text-secondary); font-size: 0.93rem; margin-bottom: 4px; }

/* ── Related Tutorials ── */
.related-tags { display: flex; flex-wrap: wrap; gap: 8px; padding: 16px 0; }
.related-tags a {
  padding: 8px 16px; border: 1px solid var(--border); border-radius: 20px;
  font-size: 0.85rem; color: var(--text-secondary); transition: all 0.15s;
}
.related-tags a:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-glow); }

/* ── FAQ ── */
.faq-item { margin-bottom: 14px; }
.faq-q { font-weight: 700; color: var(--text); font-size: 0.95rem; }
.faq-a { color: var(--text-secondary); font-size: 0.92rem; margin-top: 4px; line-height: 1.6; }

/* ── Table Scroll ── */
.table-scroll { overflow-x: auto; margin: 16px 0; }

/* ── Footer ── */
.site-footer {
  border-top: 1px solid var(--border); padding: 32px 20px 24px;
  text-align: center; color: var(--text-muted); font-size: 0.85rem; margin-top: 48px;
}
.footer-links { display: flex; justify-content: center; gap: 20px; margin-bottom: 10px; flex-wrap: wrap; }
.footer-links a { color: var(--text-secondary); }
.footer-links a:hover { color: var(--accent); }
.footer-copy { font-size: 0.8rem; }

/* ── Utility ── */
.hidden { display: none; }
.text-center { text-align: center; }
.mt-20 { margin-top: 20px; }

/* ── Responsive ── */
@media (max-width: 768px) {
  .hero h1 { font-size: 1.6rem; }
  .hero p { font-size: 0.95rem; }
  .header-nav { display: none; }
  .header-search { width: 120px; }
  .header-search:focus { width: 140px; }
  .btn-hamburger { display: block; }
  .header-nav.open {
    display: flex; flex-direction: column; position: absolute;
    top: 56px; left: 0; right: 0; background: var(--bg-card);
    border-bottom: 1px solid var(--border); padding: 12px 20px; gap: 4px;
  }
  .category-grid, .tutorial-grid { grid-template-columns: 1fr; }
  .page-header h1 { font-size: 1.4rem; }
}

/* ── Article prose (for SEO text) ── */
.seo-section { padding: 24px 0; }
.seo-section h2 { font-size: 1.25rem; font-weight: 700; margin: 28px 0 10px; }
.seo-section h3 { font-size: 1.05rem; font-weight: 700; margin: 20px 0 8px; }
.seo-section p { color: var(--text-secondary); font-size: 0.95rem; line-height: 1.7; margin-bottom: 12px; }
.seo-section strong { color: var(--text); }

/* ── Category Hub ── */
.category-hub-header { padding: 32px 0 16px; text-align: center; }
.category-hub-header h1 { font-size: 2rem; }
.category-hub-header p { color: var(--text-secondary); max-width: 600px; margin: 8px auto 0; }
