:root {
  --bg: #f5f0e7;
  --bg-accent: radial-gradient(circle at top left, rgba(16, 134, 121, 0.16), transparent 34%),
    radial-gradient(circle at top right, rgba(220, 131, 72, 0.16), transparent 28%),
    linear-gradient(180deg, #fbf7ef 0%, #f1eadf 100%);
  --surface: rgba(255, 251, 245, 0.82);
  --surface-strong: #fffaf4;
  --surface-alt: rgba(243, 236, 224, 0.92);
  --line: rgba(97, 87, 69, 0.16);
  --line-strong: rgba(16, 134, 121, 0.28);
  --text: #1f2421;
  --muted: #5d645d;
  --accent: #108679;
  --accent-strong: #075f57;
  --accent-soft: rgba(16, 134, 121, 0.12);
  --warm: #d68048;
  --warm-soft: rgba(214, 128, 72, 0.13);
  --code-bg: #142325;
  --code-text: #dffcf4;
  --shadow: 0 18px 46px rgba(43, 39, 32, 0.08);
  --radius-lg: 24px;
  --radius-md: 18px;
  --radius-sm: 12px;
  --font-sans: "IBM Plex Sans", "Segoe UI Variable", "Segoe UI", "SF Pro Display", system-ui, sans-serif;
  --font-headings: "Avenir Next", "Segoe UI Variable Display", "Trebuchet MS", sans-serif;
  --font-mono: "JetBrains Mono", "SFMono-Regular", "Cascadia Code", "Menlo", monospace;
}

body[data-theme="dark"] {
  --bg: #101818;
  --bg-accent: radial-gradient(circle at top left, rgba(31, 181, 161, 0.18), transparent 32%),
    radial-gradient(circle at top right, rgba(230, 139, 81, 0.18), transparent 24%),
    linear-gradient(180deg, #0f1716 0%, #101919 100%);
  --surface: rgba(21, 30, 30, 0.8);
  --surface-strong: #172120;
  --surface-alt: rgba(16, 24, 24, 0.92);
  --line: rgba(225, 236, 232, 0.12);
  --line-strong: rgba(69, 208, 189, 0.28);
  --text: #edf4f0;
  --muted: #9db0a8;
  --accent: #34c8b4;
  --accent-strong: #91f2e4;
  --accent-soft: rgba(52, 200, 180, 0.12);
  --warm: #f0a26c;
  --warm-soft: rgba(240, 162, 108, 0.14);
  --code-bg: #0a1010;
  --code-text: #d9fff5;
  --shadow: 0 24px 56px rgba(0, 0, 0, 0.28);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background: var(--bg-accent);
  font-family: var(--font-sans);
}

body::before,
body::after {
  content: "";
  position: fixed;
  z-index: 0;
  border-radius: 50%;
  pointer-events: none;
  filter: blur(10px);
}

body::before {
  top: 72px;
  right: 8vw;
  width: 190px;
  height: 190px;
  background: var(--warm-soft);
}

body::after {
  bottom: 8vh;
  left: 5vw;
  width: 220px;
  height: 220px;
  background: var(--accent-soft);
}

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

a:hover {
  color: var(--accent-strong);
}

button,
input {
  font: inherit;
}

.site-shell {
  position: relative;
  z-index: 1;
  width: min(1500px, calc(100% - 28px));
  margin: 16px auto 22px;
}

.panel {
  background: color-mix(in srgb, var(--surface) 94%, transparent);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
}

.topbar {
  position: sticky;
  top: 16px;
  z-index: 50;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px;
  margin-bottom: 18px;
}

.menu-btn {
  display: none;
}

.toolbar-btn,
.hero-link,
.repo-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.toolbar-btn {
  height: 48px;
  min-width: 48px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface-alt);
  color: var(--text);
  cursor: pointer;
  transition: transform 120ms ease, border-color 120ms ease;
}

.toolbar-btn:hover,
.hero-link:hover,
.repo-link:hover {
  transform: translateY(-1px);
  border-color: var(--line-strong);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  margin-right: auto;
}

.brand-mark {
  width: 44px;
  height: 44px;
  border-radius: 15px;
  background:
    linear-gradient(135deg, rgba(16, 134, 121, 0.92), rgba(16, 134, 121, 0.34)),
    linear-gradient(315deg, rgba(214, 128, 72, 0.78), rgba(214, 128, 72, 0.24));
  position: relative;
  flex: 0 0 auto;
}

.brand-mark::after {
  content: "";
  position: absolute;
  inset: 10px;
  border: 2px solid rgba(255, 255, 255, 0.94);
  border-radius: 11px 11px 5px 11px;
}

.brand-copy {
  min-width: 0;
}

.brand-title {
  display: block;
  font-family: var(--font-headings);
  font-size: 1rem;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.brand-subtitle {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 0.9rem;
}

.toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 0 1 620px;
}

.search-wrap {
  position: relative;
  flex: 1 1 auto;
}

.search-input {
  width: 100%;
  height: 48px;
  padding: 0 16px 0 46px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface-alt);
  color: var(--text);
  outline: none;
}

.search-input:focus {
  border-color: var(--line-strong);
  box-shadow: 0 0 0 4px var(--accent-soft);
}

.search-icon {
  position: absolute;
  top: 50%;
  left: 16px;
  width: 18px;
  height: 18px;
  transform: translateY(-50%);
  color: var(--muted);
}

.toolbar-btn-label {
  display: none;
}

.layout {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr) 260px;
  gap: 18px;
  align-items: start;
}

.sidebar {
  position: sticky;
  top: 100px;
  padding: 22px;
}

.sidebar-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 12px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-size: 0.84rem;
  font-weight: 700;
}

.sidebar-title {
  margin: 16px 0 8px;
  font-family: var(--font-headings);
  font-size: 1.7rem;
  line-height: 1.02;
}

.sidebar-text {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
}

.nav-list {
  list-style: none;
  padding: 0;
  margin: 20px 0 0;
  display: grid;
  gap: 10px;
}

.nav-link {
  display: block;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: color-mix(in srgb, var(--surface-alt) 90%, transparent);
  transition: transform 120ms ease, border-color 120ms ease;
}

.nav-link:hover {
  transform: translateY(-1px);
}

.nav-link.active {
  border-color: var(--line-strong);
  background: linear-gradient(180deg, var(--accent-soft), color-mix(in srgb, var(--surface-strong) 92%, transparent));
}

.nav-label {
  display: block;
  color: var(--text);
  font-weight: 700;
}

.nav-description {
  margin-top: 8px;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.5;
}

.repo-link {
  width: 100%;
  margin-top: 18px;
  height: 46px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: var(--surface-alt);
  color: var(--text);
  font-weight: 600;
}

.content {
  min-width: 0;
}

.page {
  padding: 28px;
}

.hero {
  position: relative;
  overflow: hidden;
  padding: 28px;
  margin-bottom: 18px;
  border-radius: 26px;
  border: 1px solid var(--line);
  background:
    radial-gradient(circle at top right, rgba(214, 128, 72, 0.14), transparent 30%),
    radial-gradient(circle at left center, rgba(16, 134, 121, 0.12), transparent 34%),
    color-mix(in srgb, var(--surface-strong) 96%, transparent);
}

.hero::after {
  content: "";
  position: absolute;
  top: 18px;
  right: -8px;
  width: 150px;
  height: 150px;
  border-radius: 28px;
  transform: rotate(12deg);
  border: 1px solid rgba(16, 134, 121, 0.16);
  background: linear-gradient(180deg, rgba(16, 134, 121, 0.08), transparent);
}

.hero-meta {
  position: relative;
  z-index: 1;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 14px;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 11px;
  border-radius: 999px;
  background: var(--surface-alt);
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 600;
}

.hero-title {
  position: relative;
  z-index: 1;
  margin: 0;
  max-width: 760px;
  font-family: var(--font-headings);
  font-size: clamp(2.1rem, 3.1vw, 3.3rem);
  line-height: 0.96;
  letter-spacing: -0.02em;
}

.hero-description {
  position: relative;
  z-index: 1;
  max-width: 760px;
  margin: 16px 0 0;
  color: var(--muted);
  font-size: 1.03rem;
  line-height: 1.72;
}

.hero-actions {
  position: relative;
  z-index: 1;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 18px;
}

.hero-link {
  height: 42px;
  padding: 0 14px;
  border-radius: 12px;
  background: var(--surface-alt);
  border: 1px solid var(--line);
  color: var(--text);
  font-weight: 600;
}

.hero-link.primary {
  color: white;
  border-color: transparent;
  background: linear-gradient(180deg, color-mix(in srgb, var(--accent) 86%, white), color-mix(in srgb, var(--accent) 92%, black));
}

.doc-body h1 {
  display: none;
}

.doc-body h2,
.doc-body h3,
.doc-body h4 {
  scroll-margin-top: 105px;
  font-family: var(--font-headings);
  line-height: 1.08;
  letter-spacing: -0.02em;
}

.doc-body h2 {
  margin: 34px 0 14px;
  font-size: 1.7rem;
}

.doc-body h3 {
  margin: 24px 0 12px;
  font-size: 1.22rem;
}

.doc-body h4 {
  margin: 18px 0 10px;
  font-size: 1rem;
}

.doc-body p,
.doc-body li,
.doc-body td,
.doc-body th,
.doc-body blockquote {
  line-height: 1.72;
}

.doc-body p,
.doc-body ul,
.doc-body ol,
.doc-body table,
.doc-body pre,
.doc-body blockquote {
  margin: 0 0 18px;
}

.doc-body ul,
.doc-body ol {
  padding-left: 1.45rem;
}

.doc-body li + li {
  margin-top: 8px;
}

.doc-body code {
  padding: 0.14rem 0.38rem;
  border-radius: 8px;
  background: color-mix(in srgb, var(--accent-soft) 72%, transparent);
  color: color-mix(in srgb, var(--accent-strong) 82%, var(--text));
  font-family: var(--font-mono);
  font-size: 0.92em;
}

.doc-body pre {
  padding: 18px 20px;
  overflow: auto;
  border-radius: 18px;
  background: var(--code-bg);
  color: var(--code-text);
}

.doc-body pre code {
  padding: 0;
  background: none;
  color: inherit;
  font-size: 0.92rem;
}

.doc-body table {
  width: 100%;
  border-collapse: collapse;
  border: 1px solid var(--line);
  border-radius: 18px;
  overflow: hidden;
  background: color-mix(in srgb, var(--surface-alt) 92%, transparent);
}

.doc-body th,
.doc-body td {
  padding: 12px 14px;
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid var(--line);
}

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

.doc-body th {
  color: var(--muted);
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.doc-body blockquote {
  padding: 14px 18px;
  border-left: 4px solid var(--accent);
  border-radius: 0 14px 14px 0;
  background: var(--accent-soft);
}

.stats-grid,
.skills-grid {
  display: grid;
  gap: 14px;
}

.stats-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin: 24px 0 10px;
}

.skills-grid {
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  margin: 0;
}

.stat-card,
.skill-card {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: color-mix(in srgb, var(--surface-alt) 94%, transparent);
}

.stat-value {
  font-family: var(--font-headings);
  font-size: 1.8rem;
  line-height: 1;
}

.stat-label {
  margin-top: 8px;
  color: var(--muted);
  line-height: 1.5;
}

.catalog {
  margin: 26px 0 6px;
}

.catalog-title {
  margin: 0 0 8px;
  font-family: var(--font-headings);
  font-size: 1.8rem;
}

.catalog-copy {
  margin: 0 0 16px;
  color: var(--muted);
  line-height: 1.6;
}

.skill-card {
  display: block;
  transition: transform 120ms ease, border-color 120ms ease;
}

.skill-card:hover {
  transform: translateY(-2px);
  border-color: var(--line-strong);
}

.skill-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.skill-card-title {
  color: var(--text);
  font-weight: 700;
}

.skill-card-runtime {
  flex: 0 0 auto;
  padding: 4px 8px;
  border-radius: 999px;
  background: var(--warm-soft);
  color: color-mix(in srgb, var(--warm) 74%, var(--text));
  font-size: 0.72rem;
}

.skill-card-copy {
  margin-top: 10px;
  color: var(--muted);
  line-height: 1.55;
}

.skill-card-arrow {
  margin-top: 14px;
  color: var(--accent);
  font-weight: 700;
}

.toc {
  position: sticky;
  top: 100px;
  padding: 22px;
}

.toc-title {
  margin: 0 0 14px;
  color: var(--muted);
  font-size: 0.92rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.toc-list,
.toc-list ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.toc-list ul {
  margin-top: 8px;
  padding-left: 14px;
  border-left: 1px solid var(--line);
}

.toc-item + .toc-item {
  margin-top: 10px;
}

.toc-link {
  color: var(--muted);
  line-height: 1.45;
}

.toc-empty {
  color: var(--muted);
  line-height: 1.5;
}

.search-panel {
  position: absolute;
  top: calc(100% + 10px);
  left: 0;
  right: 0;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: color-mix(in srgb, var(--surface-strong) 96%, transparent);
  box-shadow: var(--shadow);
  display: none;
}

.search-panel.visible {
  display: block;
}

.search-results {
  display: grid;
  gap: 8px;
}

.search-result {
  display: block;
  padding: 14px 16px;
  border-radius: 14px;
  background: color-mix(in srgb, var(--surface-alt) 92%, transparent);
  border: 1px solid transparent;
}

.search-result:hover {
  border-color: var(--line-strong);
}

.search-result-title {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 6px;
  color: var(--text);
  font-weight: 700;
}

.search-result-page {
  color: var(--accent);
  font-size: 0.82rem;
}

.search-result-copy,
.search-hint {
  color: var(--muted);
  line-height: 1.5;
}

.search-hint {
  padding: 14px 16px;
}

.page-footer {
  margin-top: 28px;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  color: var(--muted);
  font-size: 0.9rem;
}

.overlay {
  display: none;
}

@media (max-width: 1180px) {
  .layout {
    grid-template-columns: 300px minmax(0, 1fr);
  }

  .toc {
    display: none;
  }
}

@media (max-width: 920px) {
  .site-shell {
    width: min(100%, calc(100% - 18px));
    margin-top: 10px;
  }

  .topbar {
    top: 10px;
    flex-wrap: wrap;
  }

  .menu-btn {
    display: inline-flex;
  }

  .toolbar {
    flex: 1 0 100%;
  }

  .layout {
    display: block;
  }

  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 80;
    width: min(360px, calc(100vw - 28px));
    border-radius: 0 24px 24px 0;
    transform: translateX(-105%);
    transition: transform 180ms ease;
    overflow: auto;
  }

  body.nav-open .sidebar {
    transform: translateX(0);
  }

  .overlay {
    position: fixed;
    inset: 0;
    z-index: 70;
    background: rgba(0, 0, 0, 0.28);
  }

  body.nav-open .overlay {
    display: block;
  }

  .page {
    padding: 20px;
  }

  .hero {
    padding: 22px;
  }

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

  .toolbar-btn-label {
    display: inline;
  }
}

@media (max-width: 620px) {
  .brand {
    width: 100%;
  }

  .toolbar {
    gap: 8px;
  }

  .hero-title {
    font-size: 1.95rem;
  }

  .doc-body table {
    display: block;
    overflow-x: auto;
  }
}
