@import url("https://fonts.googleapis.com/css2?family=IBM+Plex+Sans:wght@400;500;600;700&family=Spectral:wght@400;500;600;700&display=swap");

:root {
  --bg: #f4f1ea;
  --panel: rgba(255, 252, 246, 0.9);
  --panel-strong: #fffdf8;
  --border: rgba(95, 76, 56, 0.14);
  --border-strong: rgba(95, 76, 56, 0.28);
  --text: #2f2a24;
  --muted: #695f54;
  --accent: #9a3d2f;
  --accent-soft: rgba(154, 61, 47, 0.1);
  --shadow: 0 18px 40px rgba(62, 43, 23, 0.08);
  --hero-gradient: linear-gradient(135deg, rgba(154, 61, 47, 0.94), rgba(73, 91, 89, 0.94));
  --content-width: 860px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background:
    radial-gradient(circle at top left, rgba(154, 61, 47, 0.12), transparent 28%),
    radial-gradient(circle at right 15%, rgba(73, 91, 89, 0.18), transparent 30%),
    var(--bg);
  color: var(--text);
  font-family: "Spectral", Georgia, serif;
  line-height: 1.72;
}

a {
  color: var(--accent);
  text-decoration-thickness: 1.5px;
  text-underline-offset: 0.16em;
}

a:hover {
  text-decoration-thickness: 2px;
}

code,
pre,
kbd,
samp {
  font-family: "IBM Plex Sans", "Segoe UI", sans-serif;
}

.page-backdrop {
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.16) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.16) 1px, transparent 1px);
  background-size: 24px 24px;
  mask-image: linear-gradient(to bottom, rgba(0, 0, 0, 0.42), transparent 72%);
  pointer-events: none;
}

.doc-shell {
  width: min(1380px, calc(100vw - 40px));
  margin: 24px auto 40px;
}

.doc-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.8fr) minmax(280px, 1fr);
  gap: 24px;
  padding: 28px 30px;
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 28px;
  background: var(--hero-gradient);
  box-shadow: var(--shadow);
  color: #fff8f2;
}

.hero-copy h1 {
  margin: 0 0 10px;
  font-family: "IBM Plex Sans", "Segoe UI", sans-serif;
  font-size: clamp(2.2rem, 4vw, 3.4rem);
  line-height: 1.04;
}

.eyebrow {
  margin: 0 0 12px;
  font-family: "IBM Plex Sans", "Segoe UI", sans-serif;
  font-size: 0.84rem;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: rgba(255, 248, 242, 0.78);
}

.hero-meta p {
  margin: 0;
  font-size: 1.02rem;
}

.hero-meta {
  align-self: end;
  display: grid;
  gap: 10px;
  padding: 20px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(12px);
  font-family: "IBM Plex Sans", "Segoe UI", sans-serif;
}

.hero-meta a,
.hero-meta code {
  color: #fff8f2;
}

.hero-meta code {
  background: rgba(255, 255, 255, 0.12);
  padding: 0.18rem 0.4rem;
  border-radius: 0.45rem;
}

.doc-layout {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  gap: 24px;
  margin-top: 24px;
  align-items: start;
}

.toc-panel {
  position: sticky;
  top: 18px;
}

.toc-panel-inner,
.doc-content {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 24px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.toc-panel-inner {
  padding: 18px 18px 16px;
}

.toc-heading-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.toc-heading-row h2 {
  margin: 0;
  font-family: "IBM Plex Sans", "Segoe UI", sans-serif;
  font-size: 0.98rem;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--muted);
}

.toc-toggle {
  display: none;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  background: var(--panel-strong);
  color: var(--text);
  padding: 0.45rem 0.8rem;
  font-family: "IBM Plex Sans", "Segoe UI", sans-serif;
  font-size: 0.9rem;
  cursor: pointer;
}

.toc-nav {
  max-height: calc(100vh - 120px);
  overflow: auto;
  padding-right: 4px;
}

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

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

.toc-link {
  display: block;
  padding: 0.42rem 0.7rem;
  border-radius: 12px;
  color: var(--muted);
  font-family: "IBM Plex Sans", "Segoe UI", sans-serif;
  font-size: 0.92rem;
  line-height: 1.35;
  text-decoration: none;
}

.toc-link:hover,
.toc-link.is-active {
  background: var(--accent-soft);
  color: var(--accent);
}

.toc-sublist {
  margin-left: 12px;
  padding-left: 10px;
  border-left: 1px solid var(--border);
}

.doc-main {
  min-width: 0;
}

.doc-content {
  width: min(100%, var(--content-width));
  padding: 34px clamp(20px, 4vw, 42px) 46px;
}

.doc-content > :first-child {
  margin-top: 0;
}

.doc-content h1,
.doc-content h2,
.doc-content h3,
.doc-content h4,
.doc-content h5,
.doc-content h6 {
  color: #1f1a16;
  font-family: "IBM Plex Sans", "Segoe UI", sans-serif;
  line-height: 1.18;
  scroll-margin-top: 24px;
}

.doc-content h2 {
  margin-top: 2.8rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border);
  font-size: 1.8rem;
}

.doc-content h3 {
  margin-top: 2rem;
  font-size: 1.34rem;
}

.doc-content h4 {
  margin-top: 1.4rem;
  font-size: 1.08rem;
  color: #4c4338;
}

.doc-content p,
.doc-content li,
.doc-content td,
.doc-content th,
.doc-content blockquote {
  font-size: 1.02rem;
}

.doc-content ul,
.doc-content ol {
  padding-left: 1.35rem;
}

.doc-content :not(pre) > code {
  padding: 0.16rem 0.42rem;
  border-radius: 0.45rem;
  background: rgba(73, 91, 89, 0.12);
  color: #213330;
  font-size: 0.92em;
}

.doc-content pre {
  padding: 16px 18px;
  border: 1px solid rgba(47, 42, 36, 0.08);
  border-radius: 18px;
  overflow: auto;
  background: #211d19;
  color: #f7efe3;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.code-block-shell {
  position: relative;
  margin: 1.4rem 0;
}

.code-block-shell pre,
.code-block-shell .highlight,
.code-block-shell .highlighter-rouge {
  margin: 0;
}

.copy-code-button {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 2;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.1);
  color: #f7efe3;
  padding: 0.34rem 0.72rem;
  font-family: "IBM Plex Sans", "Segoe UI", sans-serif;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  cursor: pointer;
  backdrop-filter: blur(10px);
  transition: background 140ms ease, transform 140ms ease;
}

.copy-code-button:hover {
  background: rgba(255, 255, 255, 0.18);
  transform: translateY(-1px);
}

.copy-code-button.is-copied {
  background: rgba(73, 91, 89, 0.92);
}

.code-copy-status {
  position: absolute;
  top: 48px;
  right: 14px;
  z-index: 2;
  color: rgba(247, 239, 227, 0.88);
  font-family: "IBM Plex Sans", "Segoe UI", sans-serif;
  font-size: 0.72rem;
}

.doc-content table {
  width: 100%;
  min-width: 100%;
  border-collapse: collapse;
  display: table;
  background: var(--panel-strong);
  border: 1px solid var(--border);
  border-radius: 18px;
  margin: 0;
}

.table-scroll {
  width: 100%;
  overflow-x: auto;
  margin: 1.4rem 0;
  padding-bottom: 0.25rem;
}

.table-scroll table {
  margin: 0;
}

.doc-content th,
.doc-content td {
  padding: 0.8rem 0.95rem;
  border-bottom: 1px solid var(--border);
  text-align: left;
}

.doc-content th {
  font-family: "IBM Plex Sans", "Segoe UI", sans-serif;
  background: rgba(73, 91, 89, 0.08);
}

.doc-content img {
  display: block;
  max-width: min(100%, 920px);
  height: auto;
  margin: 1.4rem auto;
  border-radius: 20px;
  border: 1px solid var(--border);
  box-shadow: 0 12px 28px rgba(62, 43, 23, 0.12);
  background: #fff;
}

.doc-content hr {
  border: 0;
  border-top: 1px solid var(--border);
  margin: 2.3rem 0;
}

.doc-content blockquote {
  margin: 1.4rem 0;
  padding: 0.8rem 1rem;
  border-left: 4px solid var(--accent);
  background: rgba(154, 61, 47, 0.06);
  border-radius: 0 14px 14px 0;
}

.highlighter-rouge,
.highlight {
  border-radius: 18px;
  overflow: hidden;
}

.highlight .c,
.highlight .c1,
.highlight .cm {
  color: #b39d7c;
  font-style: italic;
}

.highlight .k,
.highlight .kc,
.highlight .kd,
.highlight .kn,
.highlight .kr,
.highlight .kt,
.highlight .ow {
  color: #ffb454;
}

.highlight .nf,
.highlight .nb,
.highlight .fm {
  color: #7cc7ff;
}

.highlight .s,
.highlight .s1,
.highlight .s2,
.highlight .sr {
  color: #8ed081;
}

.highlight .mi,
.highlight .mf,
.highlight .mh,
.highlight .il {
  color: #f29e74;
}

.highlight .o,
.highlight .p {
  color: #f7efe3;
}

.highlight .na,
.highlight .nc,
.highlight .no {
  color: #e7c787;
}

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

@media (max-width: 960px) {
  .doc-shell {
    width: min(100vw - 20px, 1320px);
    margin: 10px auto 24px;
  }

  .doc-hero {
    grid-template-columns: 1fr;
    border-radius: 22px;
    padding: 24px 20px;
  }

  .doc-layout {
    grid-template-columns: 1fr;
  }

  .toc-panel {
    position: static;
    order: -1;
  }

  .toc-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  .toc-nav {
    display: none;
    max-height: none;
  }

  .toc-panel.is-open .toc-nav {
    display: block;
    margin-top: 8px;
  }

  .doc-content {
    width: 100%;
    padding: 24px 16px 34px;
    border-radius: 22px;
  }

  .doc-content h2 {
    font-size: 1.55rem;
  }
}
