/* Baseline reset to avoid weird width/scroll behavior */
* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: system-ui, -apple-system, Segoe UI, sans-serif;
  background: #0f172a;
  color: #e5e7eb;
  padding: 16px;
  font-size: 18px;
  line-height: 1.8;

  /* Prevent page-level horizontal scroll “white bars” */
  overflow-x: hidden;
}

/* Skip link (accessibility) */
.skip-link {
  position: absolute;
  left: -999px;
  top: 8px;
  background: #111827;
  color: #e5e7eb;
  padding: 8px 12px;
  border-radius: 8px;
  border: 1px solid #1f2937;
  z-index: 9999;
}
.skip-link:focus { left: 16px; }

/* Layout */
.layout {
  display: flex;
  max-width: 1200px;
  margin: 0 auto;
  align-items: flex-start;
  gap: 32px;
}

/* Sidebar (desktop) */
.sidebar {
  width: 260px;
  position: sticky;
  top: 16px;
  align-self: flex-start;

  /* If menu grows, sidebar can scroll internally */
  max-height: calc(100vh - 32px);
  overflow-y: auto;
  padding-right: 8px;
}

.site-title {
  color: #4ade80;
  font-size: 40px;
  margin: 0 0 12px;
  line-height: 1.1;
}
.site-subtitle {
  margin: 0 0 16px;
}

/* Content */
.content {
  flex: 1;
  min-width: 0; /* crucial for code block overflow inside flex */
}

/* Headings */
h2 {
  color: #38bdf8;
  margin-top: 40px;
  margin-bottom: 8px;
  font-size: 30px;
  scroll-margin-top: 24px;
}
h3 {
  color: #38bdf8;
  margin-top: 20px;
  margin-bottom: 6px;
  font-size: 22px;
  scroll-margin-top: 24px;
}

/* Links */
a {
  color: #a7f3d0;
  text-decoration: none;
  font-weight: 600;
}
a:hover {
  color: #bbf7d0;
  text-decoration: underline;
}

/* Nav box */
.nav-box {
  background: #020617;
  border-radius: 12px;
  padding: 16px 20px;
  width: 100%;
  box-shadow: 0 8px 30px rgba(15, 23, 42, 0.6);
  margin-bottom: 24px;
}
.nav-box ul {
  margin: 0;
  padding-left: 20px;
}
.nav-box li {
  margin-bottom: 8px;
  font-size: 20px;
}
.nav-box a {
  display: inline-block;
  padding: 6px 0; /* bigger tap target */
}

/* Code blocks */
pre {
  background: #111827;
  border: 1px solid #1f2937;
  border-radius: 12px;
  padding: 18px;
  font-size: 17px;
  line-height: 1.6;

  /* horizontal scroll when needed */
  overflow-x: auto;
  overflow-y: hidden;
  white-space: pre;

  /* Important to keep within its container */
  max-width: 100%;
}

code {
  font-family: Menlo, Monaco, Consolas, monospace;
}

/* Mobile header (visible on mobile only) */
.site-header {
  display: none;
  margin-bottom: 16px;
}
.site-header h1 {
  color: #4ade80;
  font-size: 40px;
  margin: 0 0 8px;
  line-height: 1.1;
}
.site-header p {
  margin: 0;
}

/* Mobile + small tablets */
@media (max-width: 768px) {
  .layout { flex-direction: column; gap: 0; }
  .sidebar { display: none; }
  .site-header { display: block; }
  pre { padding: 0 !important; }
}

/* Extra-small phones */
@media (max-width: 480px) {
  pre { padding: 0 !important; }
}