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

:root {
  --ink: #000000;
  --card: #121212;
  --layer: #0b0b0b;
  --line: #1f1f1f;
  --line-2: #2a2a2a;
  --text: #e6e6e6;
  --dim: #9a9a9a;
  --dimmer: #6a6a6a;
  --neon: #4be08a;
  --mid: #16233d;
  --r: 28px;
  --mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  --sans: 'IBM Plex Sans', system-ui, -apple-system, 'Noto Sans SC', 'PingFang SC', sans-serif;
  color-scheme: dark;
}

* { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  background: #000;
  -webkit-text-size-adjust: 100%;
}

html, body {
  overflow-x: hidden;
  margin: 0;
  padding: 0;
}

body {
  min-height: 100vh;
  background:
    radial-gradient(120% 70% at 50% 0%, #071119 0%, #000 62%) no-repeat,
    #000;
  color: var(--text);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.65;
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background-image: radial-gradient(#ffffff12 1px, transparent 1px);
  background-size: 22px 22px;
  opacity: .55;
  mask-image: linear-gradient(#000 0%, #000 45%, transparent 100%);
  -webkit-mask-image: linear-gradient(#000 0%, #000 45%, transparent 100%);
}

a { color: var(--neon); }

:focus-visible {
  outline: 2px solid var(--neon);
  outline-offset: 3px;
  border-radius: 6px;
}

.brand-mark {
  position: fixed;
  top: 14px;
  left: 14px;
  z-index: 70;
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line-2);
  border-radius: 16px;
  background: #0a0a0a;
  color: #fff;
  text-decoration: none;
  overflow: hidden;
  transition: border-color .2s ease, transform .2s ease;
}
.brand-mark:hover { border-color: #3c3c3c; transform: translateY(-1px); }
.brand-img { width: 30px; height: 30px; object-fit: contain; display: block; }
.brand-glyph {
  font-family: var(--mono);
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--neon);
  text-shadow: 0 0 10px #4be08a66;
}

/* ---------- shell ---------- */
.shell {
  position: relative;
  z-index: 1;
  max-width: 1180px;
  margin: 0 auto;
  padding: 92px 18px 96px;
  display: grid;
  grid-template-columns: 214px minmax(0, 1fr);
  gap: 26px;
  align-items: start;
}

/* ---------- aside ---------- */
.toc {
  position: sticky;
  top: 92px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: #0a0a0a;
  padding: 16px 12px;
}

.toc-head {
  margin: 0 0 10px;
  padding: 0 6px;
  font-family: var(--mono);
  font-size: .78rem;
  font-weight: 600;
  letter-spacing: .06em;
  color: var(--dimmer);
  text-transform: uppercase;
  word-break: break-all;
}
.toc-head span { display: block; }

.toc-list {
  list-style: none;
  margin: 0;
  padding: 0;
  counter-reset: toc;
  display: grid;
  gap: 2px;
}
.toc-list li { counter-increment: toc; }

.toc-list a {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  padding: 9px 12px;
  border: 1px solid transparent;
  border-radius: 14px;
  color: var(--dim);
  text-decoration: none;
  font-size: .94rem;
  line-height: 1.4;
  transition: color .18s ease, background .18s ease, border-color .18s ease;
}
.toc-list a::before {
  content: counter(toc, decimal-leading-zero);
  font-family: var(--mono);
  font-size: .72rem;
  color: #4a4a4a;
}
.toc-list a:hover {
  color: #fff;
  background: #111;
  border-color: var(--line-2);
}

/* ---------- hero ---------- */
.hero {
  position: relative;
  min-height: 45vh;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, .72fr);
  align-items: center;
  gap: 22px;
  padding: 26px 22px;
  border: 1px solid #1a1a1a;
  border-radius: var(--r);
  overflow: hidden;
  background:
    radial-gradient(circle at 16% 10%, #102634 0%, transparent 60%),
    radial-gradient(#ffffff10 1px, transparent 1px) 0 0 / 18px 18px,
    var(--card);
  box-shadow: 0 30px 70px -50px #000;
}

.hero-copy { text-align: center; }

.hero-title {
  margin: 0 0 12px;
  font-family: var(--mono);
  font-size: clamp(1.7rem, 6.2vw, 2.9rem);
  line-height: 1.22;
  font-weight: 700;
  letter-spacing: -.02em;
  color: #fff;
  text-shadow: 0 0 18px #4be08a3d;
  overflow-wrap: break-word;
}

.hero-desc {
  margin: 0 auto;
  max-width: 34ch;
  font-size: .96rem;
  line-height: 1.6;
  color: var(--dim);
}

.hero-media { display: flex; justify-content: center; }

.hero-img {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 20px;
  border: 1px solid #1c1c1c;
  will-change: transform;
}

.hero-grid {
  width: 100%;
  aspect-ratio: 4 / 3;
  border: 1px dashed #262626;
  border-radius: 20px;
  background:
    radial-gradient(#ffffff14 1px, transparent 1px) 0 0 / 14px 14px,
    #0a0a0a;
}

/* ---------- div body ---------- */
.article-body { display: block; }

.article-body > article {
  scroll-margin-top: 24px;
  margin-top: 18px;
  padding: 24px 20px 8px;
  border: 1px solid #191919;
  border-radius: var(--r);
  background: var(--card);
  box-shadow: 0 26px 60px -46px #000;
  animation: rise .5s ease both;
}

.article-body > article:nth-child(2) { animation-delay: .05s; }
.article-body > article:nth-child(3) { animation-delay: .1s; }
.article-body > article:nth-child(4) { animation-delay: .15s; }
.article-body > article:nth-child(5) { animation-delay: .2s; }
.article-body > article:nth-child(6) { animation-delay: .25s; }
.article-body > article:nth-child(7) { animation-delay: .3s; }

@keyframes rise {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: none; }
}

.article-body h2,
.article-body h3 {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 4px 0 12px;
  font-family: var(--mono);
  line-height: 1.35;
  letter-spacing: -.01em;
  color: #fff;
  overflow-wrap: break-word;
}

.article-body h2 { font-size: clamp(1.15rem, 3.6vw, 1.5rem); font-weight: 600; }
.article-body h3 { font-size: 1.03rem; font-weight: 500; }

.article-body h2::before {
  content: '';
  flex: 0 0 20px;
  height: 2px;
  border-radius: 2px;
  background: var(--neon);
  box-shadow: 0 0 10px #4be08a99;
}
.article-body h3::before {
  content: '';
  flex: 0 0 7px;
  height: 7px;
  border-radius: 50%;
  background: #3f6ba8;
}

.article-body h2 span,
.article-body h3 span { display: inline; }

.article-body p {
  margin: 0 0 14px;
  color: #cfcfcf;
  line-height: 1.7;
}

.article-body a {
  color: var(--neon);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}
.article-body a:hover { color: #8af0b6; }

.article-body ul,
.article-body ol { margin: 0 0 16px; padding-left: 1.15em; }
.article-body li { margin-bottom: 9px; color: #cfcfcf; }
.article-body strong { color: #fff; font-weight: 600; }
.article-body blockquote {
  margin: 0 0 16px;
  padding: 12px 16px;
  border-left: 2px solid var(--mid);
  border-radius: 0 14px 14px 0;
  background: #0e0e0e;
  color: var(--dim);
}
.article-body time {
  font-family: var(--mono);
  font-size: .8rem;
  color: var(--dimmer);
}
.article-body img {
  max-width: 100%;
  height: auto;
  border-radius: 18px;
  border: 1px solid #1c1c1c;
}
.article-body code,
.article-body pre { font-family: var(--mono); font-size: .88rem; }
.article-body pre {
  overflow-x: auto;
  padding: 14px;
  border-radius: 16px;
  background: #0a0a0a;
  border: 1px solid var(--line);
}

/* ---------- footer ---------- */
.site-foot {
  position: relative;
  z-index: 1;
  border-top: 1px solid var(--line);
  padding: 38px 18px 118px;
  text-align: center;
  background: linear-gradient(#000, #060606);
}

.foot-brand h2 {
  margin: 0;
  font-family: var(--mono);
  font-size: clamp(2.1rem, 11vw, 5.4rem);
  line-height: 1.06;
  font-weight: 700;
  letter-spacing: -.045em;
  color: #fff;
  opacity: .92;
  overflow-wrap: break-word;
}
.foot-brand h2 span { display: inline; }

.foot-meta { margin-top: 16px; }
.foot-meta p {
  margin: 4px 0;
  font-family: var(--mono);
  font-size: .8rem;
  color: var(--dimmer);
  word-break: break-all;
}

/* ---------- dock ---------- */
.dock {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px calc(9px + env(safe-area-inset-bottom, 0px));
  background: #070707f2;
  border-top: 1px solid var(--line);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.dock-wrap { position: relative; }

.dock-btn {
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 18px;
  border: 1px solid var(--line-2);
  border-radius: 999px;
  background: #111;
  color: #fff;
  font-family: var(--mono);
  font-size: .88rem;
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}
.dock-btn::-webkit-details-marker { display: none; }
.dock-btn::marker { content: ''; }
.dock-wrap[open] > .dock-btn {
  border-color: var(--neon);
  color: var(--neon);
}

.dock-menu {
  position: absolute;
  left: -4px;
  right: auto;
  bottom: calc(100% + 10px);
  min-width: min(78vw, 300px);
  margin: 0;
  padding: 8px;
  list-style: none;
  display: grid;
  gap: 2px;
  max-height: 56vh;
  overflow-y: auto;
  background: #101010;
  border: 1px solid var(--line-2);
  border-radius: 20px;
  box-shadow: 0 -24px 60px -28px #000;
  animation: rise .2s ease both;
}

.dock-menu li a {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  padding: 10px 12px;
  border-radius: 12px;
  color: var(--dim);
  text-decoration: none;
  font-size: .95rem;
}
.dock-menu li a:hover { color: #fff; background: #171717; }
.dock-num {
  font-family: var(--mono);
  font-size: .72rem;
  color: #4a4a4a;
}

.dock-search {
  flex: 1 1 auto;
  min-width: 0;
  height: 44px;
  padding: 0 16px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #0d0d0d;
  color: #eee;
  font-family: var(--sans);
  font-size: .92rem;
  appearance: none;
  -webkit-appearance: none;
}
.dock-search::placeholder { color: var(--dimmer); }
.dock-search::-webkit-search-cancel-button { filter: invert(.7); }

/* ---------- responsive ---------- */
@media (max-width: 900px) {
  .shell {
    grid-template-columns: minmax(0, 1fr);
    padding-top: 84px;
    gap: 18px;
  }
  .toc { position: static; }
  .toc-list {
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  }
  .toc-list a::before { display: none; }
  .hero {
    grid-template-columns: minmax(0, 1fr);
    min-height: 0;
    padding: 24px 18px;
  }
  .hero-media { order: 2; }
}

@media (min-width: 901px) {
  .dock { padding-left: 72px; }
  .dock summary { display: none; }
  .dock details { flex: 1 1 auto; min-width: 0; }
  .dock details > menu {
    display: flex !important;
    position: static;
    flex-wrap: wrap;
    gap: 2px 4px;
    min-width: 0;
    max-height: none;
    overflow: visible;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    animation: none;
  }
  .dock-menu li a { min-height: 44px; padding: 10px 11px; font-size: .92rem; }
  .dock-search { flex: 0 1 220px; }
}

@media (max-width: 420px) {
  .hero-desc { font-size: .9rem; }
  .article-body > article { padding: 20px 15px 4px; }
  .dock-search { max-width: 130px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .article-body > article,
  .dock-menu { animation: none; }
  .hero-img { transform: none !important; }
  .brand-mark { transition: none; }
}

button[aria-expanded]{min-width:44px;min-height:44px}
