:root {
  color-scheme: light;
  --cf-orange: #f38020;
  --cf-orange-d: #cc6816;
  --ink: #17202a;
  --ink-strong: #0b1117;
  --muted: #66717f;
  --line: #dfe4ea;
  --line-strong: #c7d0da;
  --bg: #f6f7f9;
  --surface: #ffffff;
  --surface-soft: #f0f3f6;
  --code-bg: #f4f6f8;
  --blue: #2563eb;
  --sidebar-w: 304px;
  --rightbar-w: 236px;
  --topbar-h: 68px;
  --maxw: 900px;
  --radius: 8px;
  --shadow: 0 18px 48px rgba(15, 23, 42, 0.08);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.76), rgba(246, 247, 249, 0.96)),
    radial-gradient(circle at 8% 0%, rgba(243, 128, 32, 0.08), transparent 30%),
    radial-gradient(circle at 88% 4%, rgba(37, 99, 235, 0.07), transparent 34%),
    var(--bg);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 16px;
  line-height: 1.66;
  -webkit-font-smoothing: antialiased;
}

body::before {
  position: fixed;
  inset: 0;
  z-index: -1;
  background-image:
    linear-gradient(rgba(15, 23, 42, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(15, 23, 42, 0.035) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: linear-gradient(180deg, #000 0%, transparent 70%);
  content: "";
}

a {
  color: inherit;
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  min-height: var(--topbar-h);
  display: flex;
  align-items: center;
  gap: 22px;
  padding: 14px clamp(18px, 4vw, 48px);
  border-bottom: 1px solid rgba(223, 228, 234, 0.86);
  background: rgba(246, 247, 249, 0.88);
  backdrop-filter: blur(18px);
}

.brand {
  display: inline-flex;
  min-width: 0;
  align-items: center;
  gap: 10px;
  color: var(--ink-strong);
  font-weight: 820;
  text-decoration: none;
}

.brand:hover {
  text-decoration: none;
}

.cf1-doc-logo {
  display: block;
  width: 36px;
  height: 36px;
  flex: 0 0 auto;
}

.brand-text {
  overflow: hidden;
  font-size: 1rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.topbar-actions {
  display: flex;
  flex: none;
  align-items: center;
  gap: clamp(10px, 1.6vw, 22px);
  margin-left: auto;
}

.cf1-nav {
  display: flex;
  align-items: center;
  gap: clamp(10px, 1.7vw, 22px);
  font-size: 0.9rem;
  font-weight: 720;
}

.cf1-nav a,
.topbar-link {
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 720;
  text-decoration: none;
  white-space: nowrap;
}

.cf1-nav a:hover,
.topbar-link:hover {
  color: var(--ink-strong);
}

.tg-top {
  display: inline-flex;
  min-height: 38px;
  align-items: center;
  gap: 7px;
  padding: 0 13px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink-strong);
  font-size: 0.86rem;
  font-weight: 760;
  text-decoration: none;
}

.tg-top:hover {
  transform: translateY(-1px);
  text-decoration: none;
}

.tg-top svg {
  flex: none;
}

.menu-btn {
  display: none;
  width: 40px;
  height: 40px;
  flex: none;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface);
  cursor: pointer;
}

.menu-bars,
.menu-bars::before,
.menu-bars::after {
  display: block;
  width: 18px;
  height: 2px;
  border-radius: 2px;
  background: var(--ink);
  transition: 0.2s;
}

.menu-bars {
  position: relative;
}

.menu-bars::before,
.menu-bars::after {
  position: absolute;
  left: 0;
  content: "";
}

.menu-bars::before {
  top: -6px;
}

.menu-bars::after {
  top: 6px;
}

body.nav-open .menu-bars {
  background: transparent;
}

body.nav-open .menu-bars::before {
  top: 0;
  transform: rotate(45deg);
}

body.nav-open .menu-bars::after {
  top: 0;
  transform: rotate(-45deg);
}

.layout {
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr) var(--rightbar-w);
  gap: 22px;
  align-items: start;
  max-width: 1480px;
  margin: 0 auto;
  padding: 22px clamp(14px, 3vw, 36px) 0;
}

.sidebar {
  position: sticky;
  top: calc(var(--topbar-h) + 18px);
  height: calc(100vh - var(--topbar-h) - 36px);
  overflow-y: auto;
  margin-bottom: 24px;
  padding: 16px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.86);
  box-shadow: 0 8px 28px rgba(15, 23, 42, 0.04);
}

.content {
  width: 100%;
  min-width: 0;
  max-width: calc(var(--maxw) + 96px);
  margin: 0 auto;
  padding: 0 0 80px;
}

.rightbar {
  position: sticky;
  top: calc(var(--topbar-h) + 22px);
  height: calc(100vh - var(--topbar-h) - 44px);
  overflow-y: auto;
  padding: 10px 4px;
}

.nav-extra {
  display: none;
}

.nav-ext-link,
.nav-home,
.sidebar li a {
  display: block;
  border-radius: 6px;
  text-decoration: none;
}

.nav-home {
  margin-bottom: 10px;
  padding: 8px 10px;
  color: var(--ink-strong);
  font-weight: 820;
}

.nav-home.active,
.nav-home:hover {
  background: var(--surface-soft);
  text-decoration: none;
}

.nav-group {
  margin-bottom: 18px;
}

.nav-group-title {
  margin-bottom: 6px;
  padding: 0 10px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 820;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

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

.sidebar li a,
.nav-ext-link {
  padding: 7px 10px;
  color: #374151;
  font-size: 0.88rem;
  font-weight: 650;
}

.sidebar li a:hover,
.nav-ext-link:hover {
  background: var(--surface-soft);
  text-decoration: none;
}

.sidebar li a.active {
  background: var(--ink-strong);
  color: #fff;
  font-weight: 780;
}

.toc-title {
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 820;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

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

.toc li a {
  display: block;
  padding: 3px 0 3px 10px;
  border-left: 2px solid transparent;
  color: var(--muted);
  font-size: 0.82rem;
}

.toc li a:hover {
  color: var(--ink-strong);
  text-decoration: none;
}

.toc li a.active {
  border-left-color: var(--cf-orange);
  color: var(--ink-strong);
  font-weight: 760;
}

.toc .toc-h3 a {
  padding-left: 22px;
}

.md {
  padding: clamp(26px, 4vw, 46px);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.88);
  box-shadow: 0 8px 28px rgba(15, 23, 42, 0.04);
}

.md h1,
.md h2,
.md h3,
.md h4 {
  color: var(--ink-strong);
  letter-spacing: 0;
}

.md h1 {
  margin: 0 0 18px;
  font-size: clamp(2.45rem, 5.4vw, 4.6rem);
  font-weight: 860;
  line-height: 0.96;
}

.md h2 {
  margin: 46px 0 14px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
  font-size: clamp(1.65rem, 2.8vw, 2.6rem);
  font-weight: 820;
  line-height: 1.05;
}

.md h3 {
  margin: 28px 0 8px;
  font-size: 1.15rem;
  line-height: 1.3;
}

.md h4 {
  margin: 22px 0 6px;
  font-size: 1rem;
}

.md h2:first-child,
.md h1:first-child {
  margin-top: 0;
  padding-top: 0;
  border: 0;
}

.md p {
  margin: 12px 0;
}

.md a {
  color: var(--blue);
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.md ul,
.md ol {
  margin: 12px 0;
  padding-left: 24px;
}

.md li {
  margin: 5px 0;
}

.md hr {
  margin: 32px 0;
  border: 0;
  border-top: 1px solid var(--line);
}

.md blockquote {
  margin: 16px 0;
  padding: 14px 18px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--cf-orange);
  border-radius: var(--radius);
  background: var(--surface-soft);
  color: #374151;
}

.md code {
  padding: 0.15em 0.4em;
  border-radius: 5px;
  background: var(--code-bg);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.88em;
}

.md pre {
  margin: 16px 0;
  padding: 16px 18px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--code-bg);
}

.md pre code {
  padding: 0;
  background: none;
  font-size: 0.84rem;
  line-height: 1.55;
}

.md table {
  display: block;
  width: 100%;
  margin: 18px 0;
  overflow-x: auto;
  border-collapse: collapse;
  font-size: 0.9rem;
}

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

.md thead th {
  background: var(--surface-soft);
  font-weight: 780;
}

.md tbody tr:nth-child(even) {
  background: rgba(246, 247, 249, 0.72);
}

.md :is(h2, h3, h4) {
  scroll-margin-top: calc(var(--topbar-h) + 12px);
}

.prevnext {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-top: 46px;
  padding-top: 24px;
  border-top: 1px solid var(--line);
}

.pn {
  display: flex;
  flex: 1;
  max-width: 48%;
  flex-direction: column;
  gap: 2px;
  padding: 15px 17px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
}

.pn:hover {
  border-color: var(--line-strong);
  box-shadow: var(--shadow);
  text-decoration: none;
  transform: translateY(-1px);
}

.pn span {
  color: var(--muted);
  font-size: 0.76rem;
}

.pn strong {
  color: var(--ink-strong);
  font-size: 0.94rem;
}

.pn-next {
  align-items: flex-end;
  text-align: right;
}

.hero {
  padding: 2px 0 12px;
}

.hero h1 {
  max-width: 780px;
  margin: 0 0 18px;
  font-size: clamp(2.9rem, 7vw, 5.8rem);
  font-weight: 860;
  line-height: 0.94;
}

.lede {
  max-width: 720px;
  color: #374151;
  font-size: 1.08rem;
}

.cta,
.tg-btn {
  display: inline-flex;
  min-height: 42px;
  align-items: center;
  justify-content: center;
  margin-top: 16px;
  padding: 0 16px;
  border: 1px solid var(--ink-strong);
  border-radius: var(--radius);
  background: var(--ink-strong);
  color: #fff;
  font-weight: 760;
  text-decoration: none;
}

.cta:hover,
.tg-btn:hover {
  transform: translateY(-1px);
  text-decoration: none;
}

.cards {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
  margin: 30px 0;
}

.card {
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
}

.card:hover {
  border-color: var(--line-strong);
  box-shadow: var(--shadow);
  text-decoration: none;
  transform: translateY(-2px);
}

.card h3 {
  margin: 0 0 6px;
  color: var(--ink-strong);
  font-size: 1.02rem;
}

.card p {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.modlist {
  font-size: 0.94rem;
}

.modlist li {
  margin: 8px 0;
}

.contact {
  display: flex;
  flex-wrap: wrap;
  gap: 28px;
  align-items: center;
  justify-content: space-between;
  margin: 40px 0 8px;
  padding: 26px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-soft);
}

.contact-text {
  flex: 1;
  min-width: 260px;
}

.contact-text h2 {
  margin: 0 0 8px;
  padding: 0;
  border: 0;
}

.contact-text p {
  margin: 6px 0;
  color: #4b5563;
}

.contact-scan {
  margin-top: 14px !important;
  color: var(--muted) !important;
  font-size: 0.88rem;
}

.contact-qr {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.contact-qr img {
  width: 190px;
  height: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
}

.contact-qr span {
  color: var(--ink-strong);
  font-weight: 820;
}

.diagram-fig {
  margin: 22px 0 8px;
  padding: 0;
}

.diagram-fig img {
  display: block;
  width: 100%;
  height: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
}

.diagram-fig figcaption {
  margin-top: 10px;
  color: var(--muted);
  font-size: 0.82rem;
  text-align: center;
}

.site-footer {
  border-top: 1px solid var(--line);
  background: rgba(246, 247, 249, 0.88);
}

.footer-inner {
  display: flex;
  max-width: 1400px;
  margin: 0 auto;
  padding: 18px 24px;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.footer-contact {
  color: #374151;
  font-size: 0.9rem;
}

.footer-contact a {
  font-weight: 760;
}

.footer-rights {
  color: var(--muted);
  font-size: 0.8rem;
}

.scrim {
  display: none;
}

@media (max-width: 1120px) {
  .layout {
    grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
  }

  .rightbar,
  .cf1-nav,
  .topbar-link {
    display: none;
  }
}

@media (max-width: 820px) {
  .layout {
    grid-template-columns: 1fr;
    padding-top: 16px;
  }

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

  .topbar {
    gap: 10px;
    padding: 12px 16px;
  }

  .brand-text {
    max-width: 44vw;
  }

  .tg-top .tg-label {
    display: none;
  }

  .tg-top {
    width: 40px;
    padding: 0;
    justify-content: center;
  }

  .content {
    padding: 0 0 64px;
  }

  .md {
    padding: 22px 18px;
  }

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

  .sidebar {
    position: fixed;
    top: var(--topbar-h);
    left: 0;
    z-index: 25;
    width: var(--sidebar-w);
    max-width: 84vw;
    height: calc(100vh - var(--topbar-h));
    border-radius: 0 var(--radius) var(--radius) 0;
    box-shadow: 2px 0 18px rgba(15, 23, 42, 0.16);
    transform: translateX(-100%);
    transition: transform 0.2s ease;
  }

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

  body.nav-open .scrim {
    position: fixed;
    inset: var(--topbar-h) 0 0 0;
    z-index: 20;
    display: block;
    background: rgba(15, 23, 42, 0.36);
  }

  .nav-extra {
    display: block;
    margin-top: 18px;
    padding-top: 14px;
    border-top: 1px solid var(--line);
  }

  .prevnext {
    flex-direction: column;
  }

  .pn {
    max-width: none;
  }
}

/* Cloudflare Blog-inspired editorial pass */
:root {
  --bg: #ffffff;
  --surface-soft: #f7f7f8;
  --line: #e5e7eb;
  --line-strong: #cfd6df;
  --sidebar-w: 268px;
  --rightbar-w: 202px;
  --topbar-h: 56px;
  --maxw: 760px;
  --shadow: 0 8px 22px rgba(15, 23, 42, 0.05);
}

body {
  background: #fff;
  font-size: 15px;
  line-height: 1.58;
}

body::before {
  display: none;
}

.topbar {
  min-height: var(--topbar-h);
  padding: 10px clamp(18px, 4vw, 42px);
  background: rgba(255, 255, 255, 0.94);
}

.cf1-doc-logo {
  width: 30px;
  height: 30px;
}

.brand-text {
  font-size: 0.96rem;
}

.cf1-nav a,
.topbar-link {
  font-size: 0.86rem;
}

.tg-top {
  min-height: 34px;
  padding: 0 11px;
}

.layout {
  max-width: 1280px;
  gap: 16px;
  padding: 16px clamp(12px, 2.4vw, 28px) 0;
}

.sidebar {
  top: calc(var(--topbar-h) + 12px);
  height: calc(100vh - var(--topbar-h) - 24px);
  padding: 10px 8px;
  box-shadow: none;
}

.rightbar {
  top: calc(var(--topbar-h) + 16px);
  height: calc(100vh - var(--topbar-h) - 32px);
}

.content {
  max-width: calc(var(--maxw) + 56px);
}

.md {
  padding: clamp(20px, 2.6vw, 30px);
  box-shadow: none;
}

.md h1 {
  max-width: 720px;
  margin-bottom: 12px;
  font-size: clamp(1.9rem, 3.6vw, 2.85rem);
  font-weight: 820;
  line-height: 1.06;
}

.md h2 {
  margin-top: 28px;
  padding-top: 14px;
  font-size: clamp(1.24rem, 2vw, 1.68rem);
  font-weight: 780;
}

.md h3 {
  margin-top: 18px;
  font-size: 1rem;
}

.md p {
  margin: 8px 0;
}

.md table {
  margin: 12px 0;
  font-size: 0.84rem;
}

.md th,
.md td {
  padding: 7px 9px;
}

.md blockquote {
  padding: 10px 12px;
}

.hero h1 {
  font-size: clamp(2.1rem, 4.5vw, 3.35rem);
}

.lede {
  font-size: 0.98rem;
}

.cards {
  margin: 20px 0;
}

.card {
  padding: 14px;
}

.contact {
  padding: 18px;
}

.nav-group {
  margin-bottom: 12px;
}

.nav-group-title {
  font-size: 0.68rem;
}

.sidebar li a,
.nav-ext-link {
  padding: 4px 8px;
  font-size: 0.82rem;
}

.toc li a {
  font-size: 0.78rem;
}

@media (max-width: 1120px) {
  .layout {
    grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
  }
}

/* Compact production polish */
:root {
  --sidebar-w: 286px;
  --rightbar-w: 218px;
  --topbar-h: 60px;
  --maxw: 820px;
  --shadow: 0 10px 28px rgba(15, 23, 42, 0.06);
}

body {
  font-size: 15.5px;
  line-height: 1.6;
}

.topbar {
  min-height: var(--topbar-h);
  padding-top: 10px;
  padding-bottom: 10px;
}

.cf1-doc-logo {
  width: 32px;
  height: 32px;
}

.topbar-actions,
.cf1-nav {
  gap: clamp(8px, 1.25vw, 18px);
}

.tg-top {
  min-height: 36px;
}

.layout {
  gap: 18px;
  max-width: 1390px;
  padding-top: 18px;
}

.sidebar {
  top: calc(var(--topbar-h) + 14px);
  height: calc(100vh - var(--topbar-h) - 28px);
  padding: 12px 10px;
}

.rightbar {
  top: calc(var(--topbar-h) + 18px);
  height: calc(100vh - var(--topbar-h) - 36px);
}

.content {
  max-width: calc(var(--maxw) + 72px);
}

.nav-group {
  margin-bottom: 14px;
}

.sidebar li a,
.nav-ext-link {
  padding: 5px 8px;
  font-size: 0.84rem;
}

.nav-home {
  padding: 6px 8px;
}

.md {
  padding: clamp(22px, 3vw, 34px);
}

.md h1 {
  max-width: 760px;
  margin-bottom: 14px;
  font-size: clamp(2.05rem, 4.2vw, 3.35rem);
  line-height: 1.02;
}

.md h2 {
  margin-top: 34px;
  padding-top: 16px;
  font-size: clamp(1.35rem, 2.4vw, 2rem);
  line-height: 1.12;
}

.md h3 {
  margin-top: 22px;
  font-size: 1.04rem;
}

.md p {
  margin: 9px 0;
}

.md ul,
.md ol {
  margin: 9px 0;
}

.md table {
  margin: 14px 0;
  font-size: 0.86rem;
}

.md th,
.md td {
  padding: 8px 10px;
}

.md blockquote {
  padding: 12px 14px;
}

.hero h1 {
  max-width: 760px;
  font-size: clamp(2.4rem, 5.5vw, 4rem);
}

.lede {
  font-size: 1rem;
}

.cards {
  gap: 12px;
  margin: 22px 0;
}

.card {
  padding: 16px;
}

.contact {
  margin-top: 30px;
  padding: 20px;
}

.prevnext {
  margin-top: 34px;
  padding-top: 18px;
}

.pn {
  padding: 12px 14px;
}

@media (max-width: 820px) {
  .topbar {
    min-height: var(--topbar-h);
    padding: 10px 14px;
  }

  .content {
    padding-bottom: 54px;
  }

  .md {
    padding: 20px 16px;
  }

  .md h1,
  .hero h1 {
    font-size: clamp(2.15rem, 11vw, 3.1rem);
  }
}
