@import "highlight.css";

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --page-pad: 32px;
  --text: #24292f;
  --muted: #656d76;
  --border: #d0d7de;
  --accent: #0969da;
  --surface: #ffffff;
  --code-bg: rgba(175, 184, 193, 0.12);
  --code-border: #e1e4e8;
  font-size: 16px;
}

html {
  scroll-behavior: smooth;
}

/* pane layout */

.layout-container {
  display: flex;
  flex-direction: row;
  height: 100vh;
  overflow: hidden;
}

.layout-pane {
  flex: 1;
  overflow-y: auto;
}

main.layout-pane {
  flex: 1 1 auto;
}

aside.layout-pane {
  flex: 0 0 256px;
}

@media (max-width: 980px) {
  .layout-container {
    flex-direction: column;
    height: auto;
    overflow: visible;
  }

  .layout-pane {
    width: 100%;
    flex: none;
    overflow-y: visible;
  }
}

/* Page layout */
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans",
    Helvetica, Arial, sans-serif;
  line-height: 1.6;
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.toc-sidebar {
  display: none;
  color: var(--muted);
}

.toc-sidebar--visible {
  display: block;
}

.toc-sidebar__inner {
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 24px;
  min-height: 100vh;
}

.toc-sidebar__title {
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 12px;
}

.toc-sidebar__nav {
  position: relative;
  font-size: 0.95rem;
  padding: 4px;
}

.toc-list,
.toc-sublist {
  list-style: none;
  margin: 0;
  padding: 0;
  position: relative;
  z-index: 1;
}

.toc-item {
  display: block;
  margin-bottom: 6px;
}

.toc-item:last-child {
  margin-bottom: 0;
}

.toc-sublist {
  margin-top: 6px;
  padding-left: 0;
}

.toc-item.visible > .toc-link {
  color: var(--accent);
  font-weight: 600;
}

.toc-marker {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 0;
  overflow: visible;
}

.toc-marker path {
  fill: none;
  stroke: var(--accent);
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
  opacity: 0;
  transition: opacity 0.25s ease,
    stroke-dasharray 0.35s cubic-bezier(0.22, 1, 0.36, 1);
}

.toc-link {
  position: relative;
  display: block;
  padding: 0.4rem 0.65rem;
  color: inherit;
  text-decoration: none;
  border-radius: 8px;
  transition: color 0.2s ease;
  z-index: 1;
}

.toc-link:hover {
  color: var(--accent);
}

.toc-link[data-depth="2"] {
  padding-left: 1.6rem;
  font-size: 0.9rem;
}

.toc-link[data-depth="3"] {
  padding-left: 2.5rem;
  font-size: 0.85rem;
}

.toc-link.is-active {
  color: var(--accent);
  font-weight: 600;
}

@media (max-width: 980px) {
  .toc-sidebar__inner {
    padding: 16px;
    margin-bottom: 24px;
    min-height: auto;
    border-bottom: 1px solid var(--border);
  }

  .toc-link {
    padding: 0.35rem 0.5rem;
  }

  .toc-link[data-depth="2"] {
    padding-left: 1.2rem;
  }

  .toc-link[data-depth="3"] {
    padding-left: 1.8rem;
  }

  .toc-link::before {
    display: none;
  }
}

.content div[align="center"] img {
  max-width: 220px;
  height: auto;
  display: block;
  margin: 0 auto;
}

/* Content area */
.content {
  background: var(--surface);
  padding: var(--page-pad);
  width: min(100%, 50rem);
}

/* Headings */
h1,
h2,
h3,
h4,
h5,
h6 {
  margin-top: 2rem;
  margin-bottom: 0.75rem;
  font-weight: 600;
  line-height: 1.2;
  scroll-margin-top: 96px;
}

h1 {
  font-size: 2.25rem;
  padding: 0.5rem 0;
  margin-top: 5rem;
  color: var(--text);
}

h2 {
  margin-top: 4rem;
  font-size: 1.5rem;
  padding-bottom: 0.375rem;
  color: var(--text);
}

h3 {
  font-size: 1.25rem;
  color: var(--text);
  margin-top: 1.5rem;
}

h4 {
  font-size: 1.125rem;
  color: var(--muted);
}

/* Text content */
p {
  margin-bottom: 1rem;
  color: var(--text);
}

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

/* Lists */
ul,
ol {
  margin-bottom: 1rem;
  padding-left: 1.25rem;
}

li {
  margin-bottom: 0.4rem;
}

/* Code & preformatted blocks */
code {
  padding: 0.2em 0.4em;
  margin: 0;
  font-size: 85%;
  background-color: var(--code-bg);
  border-radius: 4px;
  border: 1px solid var(--code-border);
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Consolas,
    "Liberation Mono", Menlo, monospace;
  color: #e36209;
  font-weight: 500;
}

pre {
  padding: 20px;
  overflow: auto;
  font-size: 85%;
  line-height: 1.5;
  background: linear-gradient(135deg, #f8f9fa 0%, #ffffff 100%);
  border-radius: 8px;
  margin-bottom: 1.5rem;
  border: 1px solid var(--code-border);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
  position: relative;
}

pre code {
  background-color: transparent;
  border: 0;
  padding: 0;
  margin: 0;
  font-size: 100%;
  color: var(--text);
  font-weight: normal;
}

/* Add a subtle top border to code blocks for visual separation */
pre::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--accent), #22c55e);
  border-radius: 8px 8px 0 0;
}

/* Syntax highlighting styles for Rouge */
.highlight {
  background: linear-gradient(135deg, #f8f9fa 0%, #ffffff 100%);
  border-radius: 8px;
  margin-bottom: 1.5rem;
  border: 1px solid var(--code-border);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
  position: relative;
  overflow: hidden;
}

.highlight::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--accent), #22c55e);
  border-radius: 8px 8px 0 0;
}

.highlight pre {
  background: transparent;
  border: none;
  box-shadow: none;
  margin: 0;
  padding: 20px;
}

.highlight pre::before {
  display: none;
}

/* GitHub link styling */
.github-link-container {
  padding-bottom: 20px;
}

.github-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  background: var(--surface);
  color: var(--text);
  text-decoration: none;
  border-radius: 6px;
  border: 1px solid var(--border);
  box-shadow: 0 2px 8px rgba(12, 15, 19, 0.06);
  font-weight: 500;
  transition: box-shadow 0.2s, background 0.2s;
}

.github-link:hover {
  box-shadow: 0 4px 16px rgba(12, 15, 19, 0.12);
}
