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

:root {
  --bg: #0d1117;
  --bg-secondary: #161b22;
  --bg-card: #1c2128;
  --text: #e6edf3;
  --text-muted: #8b949e;
  --accent: #58a6ff;
  --accent-hover: #79c0ff;
  --border: #30363d;
  --code-bg: #0d1117;
  --max-width: 960px;
  --nav-height: 60px;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.7;
  font-size: 16px;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); text-decoration: underline; }

/* === Navigation === */
nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
  height: var(--nav-height);
  display: flex;
  align-items: center;
}

nav .nav-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 1.5rem;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

nav .site-title {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text);
}
nav .site-title:hover { color: var(--accent); text-decoration: none; }

nav .nav-links { display: flex; gap: 1.5rem; list-style: none; }
nav .nav-links a { color: var(--text-muted); font-size: 0.9rem; }
nav .nav-links a:hover, nav .nav-links a.active { color: var(--accent); text-decoration: none; }

/* === Layout === */
.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 2rem 1.5rem;
}

/* === Homepage === */
.hero {
  text-align: center;
  padding: 4rem 0 2rem;
}
.hero h1 { font-size: 2.5rem; margin-bottom: 0.5rem; }
.hero p { color: var(--text-muted); font-size: 1.1rem; }

/* === Homepage Hero Image === */
.homepage-hero {
  width: 100vw;
  margin-left: calc(-50vw + 50%);
  height: 420px;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  position: relative;
  margin-top: -2rem;
  margin-bottom: 2rem;
}

.homepage-hero-overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 3rem 2rem;
  background: linear-gradient(transparent 0%, rgba(13, 17, 23, 0.85) 60%, rgba(13, 17, 23, 1) 100%);
  text-align: center;
}

.homepage-hero-overlay h1 {
  font-size: 2.8rem;
  color: var(--text);
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.8);
  margin-bottom: 0.5rem;
}

.homepage-hero-overlay p {
  color: var(--text-muted);
  font-size: 1.2rem;
  text-shadow: 0 1px 6px rgba(0, 0, 0, 0.6);
}

.section-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.5rem;
  margin-top: 2rem;
}

.section-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1.5rem;
  transition: border-color 0.2s;
}
.section-card:hover { border-color: var(--accent); }
.section-card h3 { margin-bottom: 0.5rem; }
.section-card p { color: var(--text-muted); font-size: 0.9rem; }
.section-card .tutorial-count {
  display: inline-block;
  margin-top: 0.75rem;
  font-size: 0.8rem;
  color: var(--accent);
}

/* === Tutorial List === */
.page-header {
  border-bottom: 1px solid var(--border);
  padding-bottom: 1rem;
  margin-bottom: 2rem;
}
.page-header h1 { font-size: 2rem; }
.page-header p { color: var(--text-muted); margin-top: 0.25rem; }

.tutorial-list { list-style: none; }
.tutorial-list li {
  border-bottom: 1px solid var(--border);
  padding: 1rem 0;
}
.tutorial-list li:last-child { border-bottom: none; }
.tutorial-list a { font-size: 1.1rem; }
.tutorial-list .tutorial-desc { color: var(--text-muted); font-size: 0.9rem; margin-top: 0.25rem; }

/* === Tutorial Hero Image === */
.tutorial-hero {
  width: 100vw;
  margin-left: calc(-50vw + 50%);
  height: 340px;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  position: relative;
  margin-bottom: 2rem;
  margin-top: -2rem;
}

.tutorial-hero-overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 2rem;
  background: linear-gradient(transparent, rgba(13, 17, 23, 0.95));
}

.tutorial-hero-overlay h1 {
  max-width: var(--max-width);
  margin: 0 auto;
  font-size: 2rem;
  color: var(--text);
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.7);
  border: none;
  padding: 0;
}

/* === Tutorial Content === */
.tutorial-content {
  max-width: 760px;
}

.tutorial-content h1 { font-size: 2rem; margin-bottom: 1.5rem; border-bottom: 1px solid var(--border); padding-bottom: 0.75rem; }
.tutorial-content h2 { font-size: 1.5rem; margin: 2rem 0 0.75rem; }
.tutorial-content h3 { font-size: 1.25rem; margin: 1.5rem 0 0.5rem; }
.tutorial-content h4 { font-size: 1.1rem; margin: 1.25rem 0 0.5rem; }

.tutorial-content p { margin-bottom: 1rem; }
.tutorial-content ul, .tutorial-content ol { margin: 0 0 1rem 1.5rem; }
.tutorial-content li { margin-bottom: 0.35rem; }
.tutorial-content img {
  max-width: 100%;
  border-radius: 6px;
  border: 1px solid var(--border);
  margin: 1rem 0;
}

.tutorial-content pre {
  background: var(--code-bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 1rem;
  overflow-x: auto;
  margin: 1rem 0;
  font-size: 0.9rem;
  line-height: 1.5;
}

.tutorial-content code {
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  font-size: 0.9em;
}

.tutorial-content p code, .tutorial-content li code {
  background: var(--bg-secondary);
  padding: 0.15em 0.4em;
  border-radius: 4px;
}

.breadcrumb {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 1.5rem;
}
.breadcrumb a { color: var(--text-muted); }
.breadcrumb a:hover { color: var(--accent); }

/* === Footer === */
footer {
  border-top: 1px solid var(--border);
  text-align: center;
  padding: 2rem;
  color: var(--text-muted);
  font-size: 0.85rem;
  margin-top: 4rem;
}

/* === Responsive === */
@media (max-width: 600px) {
  .hero h1 { font-size: 1.8rem; }
  .section-grid { grid-template-columns: 1fr; }
  nav .nav-links { gap: 1rem; }
}
