@charset "utf-8";

:root {
  --ink: #000000;
  --paper: #ffffff;
  --grey: #f2f2f2;
  --r: 4px;
  --u: 8px;
  --wrap: 1180px;
  --edge: max(16px, calc((100vw - var(--wrap)) / 2));
}

*,
*::before,
*::after { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: "Baloo 2", "Comic Neue", system-ui, -apple-system, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  font-size: 17px;
  line-height: 1.7;
  font-weight: 400;
  letter-spacing: .005em;
}

a { color: inherit; }
img { max-width: 100%; }
p { margin: 0 0 16px; }

/* ---------- 顶栏 ---------- */
.bar {
  position: sticky;
  top: 0;
  z-index: 30;
  background: var(--paper);
  border-bottom: 3px solid var(--ink);
}

.bar__inner {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: var(--u);
  max-width: var(--wrap);
  margin: 0 auto;
  padding: 6px 16px;
}

.brand {
  justify-self: center;
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 14px;
  border: 2px solid var(--ink);
  border-radius: var(--r);
  text-decoration: none;
  font-weight: 700;
  font-size: 17px;
  letter-spacing: .04em;
  white-space: nowrap;
}
.brand:hover,
.brand:focus-visible { background: var(--ink); color: var(--paper); }

.nav > ul {
  display: flex;
  gap: 2px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.nav--b > ul { justify-content: flex-end; }

.nav a {
  display: flex;
  align-items: center;
  min-height: 44px;
  padding: 0 10px;
  border-radius: var(--r);
  text-decoration: none;
  font-weight: 600;
  font-size: 16px;
  line-height: 1.2;
  white-space: nowrap;
}
.nav a:hover,
.nav a:focus-visible { background: var(--ink); color: var(--paper); }

.has-sub { position: relative; }
.has-sub > .drop::after {
  content: "＋";
  margin-left: 6px;
  font-size: 13px;
  line-height: 1;
}

.nav .has-sub > .sub {
  display: none;
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  z-index: 40;
  min-width: 196px;
  margin: 0;
  padding: 4px;
  list-style: none;
  background: var(--paper);
  border: 2px solid var(--ink);
  border-radius: var(--r);
  box-shadow: 6px 6px 0 var(--ink);
}
.nav .has-sub:hover > .sub,
.nav .has-sub:focus-within > .sub {
  display: flex;
  flex-direction: column;
}

/* ---------- 版面骨架 ---------- */
main {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 272px;
  gap: 32px;
  max-width: var(--wrap);
  margin: 0 auto;
  padding: 0 16px;
}

.article { min-width: 0; overflow-wrap: break-word; }

.hero {
  display: grid;
  grid-template-columns: 1.05fr .95fr;
  gap: 32px;
  align-items: end;
  min-height: 70vh;
  padding: 48px 0 40px;
  border-bottom: 3px solid var(--ink);
}
.hero--plain {
  grid-template-columns: 1fr;
  min-height: 46vh;
}

.hero__copy::before {
  content: "";
  display: block;
  width: 64px;
  height: 8px;
  margin-bottom: 28px;
  border-radius: var(--r);
  background: var(--ink);
}

.hero h1 {
  margin: 0;
  font-size: clamp(2rem, 4.6vw, 3.4rem);
  line-height: 1.14;
  font-weight: 700;
  letter-spacing: -.012em;
}

.hero__media {
  align-self: stretch;
  margin: 0;
  overflow: hidden;
  border: 2px solid var(--ink);
  border-radius: var(--r);
  background: var(--grey);
}
.hero__img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* ---------- 正文区块 ---------- */
.article > div { scroll-margin-top: 104px; }

.article > div + div {
  border-top: 3px solid var(--ink);
  padding-top: 40px;
  padding-bottom: 40px;
}
.article > div:last-child { padding-bottom: 56px; }

.article h2 {
  margin: 0 0 14px;
  font-size: clamp(1.45rem, 2.9vw, 2.05rem);
  line-height: 1.25;
  font-weight: 700;
  letter-spacing: -.008em;
}
.article h3 {
  margin: 28px 0 10px;
  font-size: 1.22rem;
  line-height: 1.4;
  font-weight: 700;
}
.article p,
.article li { font-size: 17px; line-height: 1.8; }
.article ul,
.article ol { margin: 0 0 18px; padding-left: 1.35em; }
.article li { margin: 6px 0; }

.article a {
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-thickness: 2px;
}
.article a:hover { background: var(--ink); color: var(--paper); text-decoration: none; }

.article blockquote {
  margin: 20px 0;
  padding: 12px 18px;
  border-left: 5px solid var(--ink);
  border-radius: var(--r);
  background: var(--grey);
}
.article blockquote p:last-child { margin-bottom: 0; }

.article table {
  width: 100%;
  max-width: 100%;
  margin: 18px 0;
  border-collapse: collapse;
}
.article th,
.article td {
  border: 1px solid var(--ink);
  padding: 8px 10px;
  text-align: left;
  font-size: 16px;
  line-height: 1.6;
}
.article th { background: var(--grey); font-weight: 700; }

.article pre {
  margin: 18px 0;
  padding: 14px;
  overflow-x: auto;
  border: 2px solid var(--ink);
  border-radius: var(--r);
  background: var(--grey);
  font-size: 15px;
  line-height: 1.6;
}
.article code { font-family: ui-monospace, "SFMono-Regular", Menlo, monospace; font-size: .95em; }
.article img { height: auto; border-radius: var(--r); }
.article iframe { max-width: 100%; border-radius: var(--r); }

/* ---------- 右侧栏 ---------- */
.rail {
  position: sticky;
  top: 104px;
  align-self: start;
  margin-top: 48px;
  padding-left: 16px;
  border-left: 3px solid var(--ink);
}
.rail h2 {
  margin: 0 0 10px;
  font-size: 16px;
  line-height: 1.45;
  font-weight: 700;
}
.rail .subtitle {
  margin: 0;
  font-size: 16px;
  line-height: 1.75;
}

/* ---------- 页脚 ---------- */
.end {
  margin-top: 56px;
  padding: 28px 16px 36px;
  border-top: 3px solid var(--ink);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  text-align: center;
}
.end p { margin: 0; font-size: 16px; font-weight: 600; }
.end small { font-size: 16px; }
.end small a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 14px;
  border: 2px solid var(--ink);
  border-radius: var(--r);
  text-decoration: none;
  font-weight: 600;
}
.end small a:hover,
.end small a:focus-visible { background: var(--ink); color: var(--paper); }

/* ---------- 动效 ---------- */
html.motion .article > div + div {
  opacity: 0;
  transform: translateY(14px);
  transition: opacity .5s ease, transform .5s cubic-bezier(.2, .7, .3, 1);
}
html.motion .article > div.is-in {
  opacity: 1;
  transform: none;
}

/* ---------- 断点 ---------- */
@media (max-width: 960px) {
  main {
    grid-template-columns: 1fr;
    gap: 0;
  }
  .rail {
    position: static;
    margin: 36px 0 0;
    padding: 18px 0 0;
    border-left: 0;
    border-top: 3px solid var(--ink);
  }
  .hero,
  .hero--plain {
    grid-template-columns: 1fr;
    gap: 24px;
    min-height: 0;
    padding: 32px 0 32px;
  }
  .hero__media {
    aspect-ratio: 4 / 3;
    min-height: 0;
  }
  .article > div { scroll-margin-top: 24px; }
}

@media (max-width: 720px) {
  .bar { position: static; }
  .bar__inner {
    grid-template-columns: 1fr;
    gap: 0;
    padding: 10px 12px 8px;
  }
  .brand {
    order: -1;
    justify-self: center;
    font-size: 16px;
    margin-bottom: 8px;
  }
  .nav > ul,
  .nav--b > ul {
    flex-wrap: wrap;
    justify-content: center;
    gap: 0;
  }
  .nav a { font-size: 16px; padding: 0 8px; }
  .nav .has-sub > .sub {
    left: auto;
    right: 0;
    box-shadow: 4px 4px 0 var(--ink);
  }
  .hero h1 { font-size: clamp(1.9rem, 8.2vw, 2.6rem); }
  .hero__copy::before { margin-bottom: 20px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  html.motion .article > div + div {
    opacity: 1;
    transform: none;
    transition: none;
  }
}

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